This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A209229 #96 Oct 16 2024 14:54:22 %S A209229 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, %T A209229 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, %U A209229 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 %N A209229 Characteristic function of powers of 2, cf. A000079. %C A209229 Essentially the same as A036987 (the Fredholm-Rueppel sequence). %C A209229 Completely multiplicative with a(2^e) = 1, a(p^e) = 0 for odd primes p. - _Mitch Harris_, Apr 19 2005 %C A209229 Moebius transform of A001511. - _R. J. Mathar_, Jun 20 2014 %D A209229 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). %D A209229 Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2. %H A209229 Antti Karttunen, <a href="/A209229/b209229.txt">Table of n, a(n) for n = 0..65537</a> (terms 0..1000 from G. C. Greubel) %H A209229 <a href="/index/Ch#char_fns">Index entries for characteristic functions</a> %H A209229 <a href="/index/Di#divseq">Index to divisibility sequences</a> %F A209229 a(A000079(n)) = 1; a(A057716(n)) = 0. %F A209229 a(n+1) = A036987(n). %F A209229 a(n) = if n < 2 then n else (if n is even then a(n/2) else 0). %F A209229 The generating function g(x) satisfies g(x) - g(x^2) = x. - _Joerg Arndt_, May 11 2010 %F A209229 Dirichlet g.f.: 1/(1 - 2^(-s)). - _R. J. Mathar_, Mar 07 2012 %F A209229 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 %F A209229 With a(0) = 0 removed is convolution inverse of A104977. - _Michael Somos_, Jan 03 2013 %F A209229 From _Antti Karttunen_, Nov 19 2017: (Start) %F A209229 a(n) = abs(A154269(n)). %F A209229 For n > 1, a(n) = A069517(n)/2 = 2 - A201219(n). (End) %F A209229 a(n) = A048298(n)/n. - _R. J. Mathar_, Jan 07 2021 %F A209229 a(n) = floor((2^n)/n) - floor((2^n - 1)/n), for n>=1. - _Ridouane Oudra_, Oct 15 2021 %e A209229 x + x^2 + x^4 + x^8 + x^16 + x^32 + x^64 + x^128 + x^256 + x^512 + x^1024 + ... %p A209229 A209229 := proc(n) %p A209229 if n <= 0 then %p A209229 0 ; %p A209229 elif n = 1 then %p A209229 1; %p A209229 elif type (n,'odd') or A001221(n) > 1 then %p A209229 0 ; %p A209229 else %p A209229 1; %p A209229 end if; %p A209229 end proc: %p A209229 seq(A209229(n),n=0..40) ; # _R. J. Mathar_, Jan 07 2021 %t A209229 a[n_] := Boole[n == 2^IntegerExponent[n, 2]]; Table[a[n], {n, 0, 100}] (* _Jean-François Alcover_, May 06 2014 *) %t A209229 Table[If[IntegerQ[Log[2,n]],1,0],{n,0,100}] (* _Harvey P. Dale_, Jun 24 2018 *) %o A209229 (Haskell) %o A209229 a209229 n | n < 2 = n %o A209229 | n > 1 = if m > 0 then 0 else a209229 n' %o A209229 where (n',m) = divMod n 2 %o A209229 (PARI) a(n)=n==1<<valuation(n,2) \\ _Charles R Greathouse IV_, Mar 07 2012 %o A209229 (PARI) {a(n) = if( n<2 || n%2, n==1, isprimepower(n) > 0)} \\ _Michael Somos_, Jan 03 2013 %o A209229 (C) int a (unsigned long n) { return n & !(n & (n-1)); } /* _Charles R Greathouse IV_, Sep 15 2012 */ %o A209229 (Python) %o A209229 def A209229(n): return int(not(n&-n)^n) if n else 0 # _Chai Wah Wu_, Jul 08 2022 %Y A209229 Cf. A001511, A029837 (partial sums), A087003 (moebius transform), A090678, A104977, A154955 (Dirichlet inverse). %Y A209229 Cf. A069517, A154269, A201219, A255738. %K A209229 nonn,mult,easy %O A209229 0,1 %A A209229 _Reinhard Zumkeller_, Mar 06 2012