|
|
A209229
|
|
Characteristic function of powers of 2, cf. A000079.
|
|
172
|
|
|
0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,1
|
|
COMMENTS
|
Essentially the same as A036987 (the Fredholm-Rueppel sequence).
Completely multiplicative with a(2^e) = 1, a(p^e) = 0 for odd primes p. - Mitch Harris, Apr 19 2005
|
|
REFERENCES
|
Michel Dekking, Michel Mendes France and Alf van der Poorten, "Folds", The Mathematical Intelligencer, Vol. 4, No. 3 (1982), pp. 130-138 & front cover, and Vol. 4, No. 4 (1982), pp. 173-181 (printed in two parts).
Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
|
|
LINKS
|
|
|
FORMULA
|
a(n) = if n < 2 then n else (if n is even then a(n/2) else 0).
The generating function g(x) satisfies g(x) - g(x^2) = x. - Joerg Arndt, May 11 2010
G.f.: x / (1 - x / (1 + x / (1 + x / (1 - x / (1 + x / (1 - x / ...)))))) = x / (1 + b(1) * x / (1 + b(2) * x / (1 + b(3) * x / ...))) where b(n) = (-1)^ A090678(n+1). - Michael Somos, Jan 03 2013
a(n) = floor((2^n)/n) - floor((2^n - 1)/n), for n>=1. - Ridouane Oudra, Oct 15 2021
|
|
EXAMPLE
|
x + x^2 + x^4 + x^8 + x^16 + x^32 + x^64 + x^128 + x^256 + x^512 + x^1024 + ...
|
|
MAPLE
|
if n <= 0 then
0 ;
elif n = 1 then
1;
elif type (n, 'odd') or A001221(n) > 1 then
0 ;
else
1;
end if;
end proc:
|
|
MATHEMATICA
|
a[n_] := Boole[n == 2^IntegerExponent[n, 2]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, May 06 2014 *)
Table[If[IntegerQ[Log[2, n]], 1, 0], {n, 0, 100}] (* Harvey P. Dale, Jun 24 2018 *)
|
|
PROG
|
(Haskell)
a209229 n | n < 2 = n
| n > 1 = if m > 0 then 0 else a209229 n'
where (n', m) = divMod n 2
(PARI) {a(n) = if( n<2 || n%2, n==1, isprimepower(n) > 0)} /* Michael Somos, Jan 03 2013
(Python)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,mult,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|