OFFSET
1,3
FORMULA
a(2^k) = 1, a(2n) = a(n).
MATHEMATICA
X[a_, b_] := Module[{A, B, C, x},
A = Reverse@IntegerDigits[a, 2];
B = Reverse@IntegerDigits[b, 2];
C = Expand[
Sum[A[[i]]*x^(i - 1), {i, 1, Length[A]}]*
Sum[B[[i]]*x^(i - 1), {i, 1, Length[B]}]];
PolynomialMod[C, 2] /. x -> 2];
T[n_, k_] := Module[{x = BitXor[n - 1, 2 n - 1], k0 = k},
For[i = 1, True, i++, If[n*i == X[x, i],
If[k0 == 1, Return[i], k0--]]]];
a[n_] := T[n, 1];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 04 2022 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Feb 07 2006
STATUS
approved