OFFSET
1,2
COMMENTS
Positive sums and differences of pairs of distinct powers of two, sorted, with duplicates removed.
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..1602
FORMULA
x(n) = { 2^x - 2^y if x < y }, { 2^x if x = y }, { 2^x + 2^y if x > y} where x = ceiling(sqrt(n)) and y = n - (x-1)^2 - 1.
EXAMPLE
1 = 2^1 - 2^0; 2 = 2^2 - 2^1; 3 = 2^1 + 2^0 or 2^2 - 2^0; 4 = 2^3 - 2^2; 5 = 2^2 + 2^0.
MATHEMATICA
Union[Flatten[Table[{2^n, 2^n - 2^k, 2^n + 2^k}, {n, 8}, {k, 0, n - 1}]]] (* Ivan Neretin, Jul 29 2015 *)
PROG
(Octave) x=[]; m=12; for i = 0:m; x=[x, 2^i-2.^([(i-2):-1:0]), 2^i, 2^i+2.^([0 :(i-2)])]; end; x
CROSSREFS
KEYWORD
nonn
AUTHOR
Phil Rutschman (phil(AT)rsnsoft.com), Apr 19 2007
STATUS
approved