Viewing a single comment thread. View all comments

bildramer t1_iyca5ey wrote

Fun fact: (with some assumptions about operators) only one of the cyclic permutations of a RPN (or PN) string is valid, so you can be sneaky and define the value of any string as the value of the only parsable-as-RPN cyclic permutation of it, leading to funny stuff like 1 + 2 - 3 = 2, 5 * 6 - 7 + 8 * 9 = 368. Another fun fact: all strings with N numbers and N-1 binary operators are valid under that scheme, such as - + 8 7 * 6 5 * * 4 3 = 169. Proofs are an exercise to the reader.

2