login
A396674
a(n) is the Fibonacci-code successor of n.
2
1, 2, 4, 4, 5, 8, 8, 8, 9, 10, 16, 16, 13, 16, 16, 16, 17, 18, 20, 20, 21, 32, 32, 32, 25, 26, 32, 32, 29, 32, 32, 32, 33, 34, 36, 36, 37, 40, 40, 40, 41, 42, 64, 64, 45, 64, 64, 64, 49, 50, 52, 52, 53, 64, 64, 64, 57, 58, 64, 64, 61, 64, 64, 64, 65, 66, 68, 68, 69, 72
OFFSET
0,2
REFERENCES
Donald E. Knuth, The Art of Computer Programming, Volume 1, Fundamental Algorithms. Third Edition, Addison-Wesley, 1997. Chapter 1.2.8, exercise 34, page 86, introduces the Fibonacci number system first described by E. Zeckendorf, see answer page 495.
Donald E. Knuth, The Art of Computer Programming, Volume 4A, Combinatorial Algorithms Part 1. Pearson Education, 2011. Chapter 7.1.3, exercise 158, page 196, asks for a method to increment Fibonacci codewords with answer on page 607.
MATHEMATICA
A396674[n_] := BitOr[n, BitAnd[#, BitNot[#+1]]] + 1 & [BitOr[n, BitShiftRight[n]]];
Array[A396674, 100, 0] (* Paolo Xausa, Jun 08 2026, after PARI *)
PROG
(PARI) a396674(x) = my(y=bitor(x, x>>1), z=bitand(y, bitneg(y+1))); bitor(x, z)+1
CROSSREFS
Cf. A215026.
Sequence in context: A327625 A084824 A344710 * A184615 A151969 A261393
KEYWORD
nonn,easy
AUTHOR
Hugo Pfoertner, Jun 08 2026
STATUS
approved