OFFSET
0,2
COMMENTS
It appears that a(n) is the least positive number with binary expansion Sum_{k = 0..w} b_k * 2^k such that the polynomial Sum_{k = 0..w} (X+k)^n * (-1)^b_k is constant. - Rémy Sigrist, Sep 15 2020
FORMULA
The "~" operator, as used here, represents bitwise complement. a(0) = 1. a(n) = a(n-1) followed by ~a(n-1).
MATHEMATICA
FromDigits[#, 2] & /@ NestList[ Flatten[# /. {0 -> {0, 1}, 1 -> {1, 0}}] &, {1}, 9] (* Robert G. Wilson v, Aug 16 2011 *)
PROG
(Pseudocode)
function invert(string s) returns string { s.replace("0", "2"); s.replace("1", "0"); s.replace("2", "1"); }
function f(int n) returns string { if (n==0) return "1"; return concat(f(n-1), invert(f(n-1))); } // Blatant opportunity for optimization
function a(int n) returns int { return f(n).InterpretAsBinary(); }
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Dan Reif (integer-sequences(AT)angelfaq.com), Nov 28 2007, corrected Nov 30 2007
STATUS
approved