A379719 a(0) = 0, and for any n > 0, a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference of a(n-1) and a(n) is a power of 2; in case of a tie, preference is given to the positive value.
0, 1, -1, -2, 2, 3, 4, -4, -3, 5, 6, 7, 8, -8, -6, -5, -7, 9, 10, 11, 12, 13, 14, 15, 16, -16, -12, -10, -9, -11, -13, -14, -15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, -32, -24, -20, -18, -17, -19, -21, -22, -23, -25, -26, -27, -28
Offset: 0
Keywords
Examples
The first terms are: n a(n) |a(n)-a(n-1)| -- ---- ------------- 0 0 N/A 1 1 2^0 2 -1 2^1 3 -2 2^0 4 2 2^2 5 3 2^0 6 4 2^0 7 -4 2^3 8 -3 2^0 9 5 2^3 10 6 2^0 11 7 2^0 12 8 2^0 13 -8 2^4 14 -6 2^1
Links
- Rémy Sigrist, Table of n, a(n) for n = 0..10000
- Rémy Sigrist, PARI program
Programs
-
PARI
\\ See Links section.
Comments