OFFSET
1,2
COMMENTS
Let S be the sequence of all possible expressions built from numbers 2 and exponentiations (^), sorted according to their natural structural ordering (2, 2^2, 2^(2^2), (2^2)^2, 2^(2^(2^2)), 2^((2^2)^2) and so on - see the exact definition in Haskell below).
Let S' be S stable-sorted according to the numeric values of its elements in ascending order (the stable sorting is a sorting that keeps the order of elements with equal keys - so 2^(2^2) and (2^2)^2 will be kept in the original order).
This sequence is S' where each expression is replaced with its original index (1-based) in S; it is a permutation of the natural numbers sequence.
PROG
(Haskell) data Expr = Two | Expr :^: Expr
-- needed only for presentation
instance Show Expr where show Two = "2"; show (x :^: y) = "(" ++ show x ++ "^" ++ show y ++ ")"
ofSize 1 = [Two]
ofSize n = [left :^: right | k <- [1..n-1], left <- ofSize k, right <- ofSize (n-k)]
-- this defines the S sequence
s = [e | n <- [1..], e <- ofSize n]
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Reshetnikov, May 01 2010
EXTENSIONS
First 100 terms from D. S. McNeil, May 04 2010
STATUS
approved