OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
EXAMPLE
34 in binary is 100010. This has 4 zeros. And since 4 is a power of 2, 34 is included in the sequence.
MAPLE
a:=proc(n) local nn, n0: nn:=convert(n, base, 2): n0:=nops(nn)-add(nn[j], j=1.. nops(nn)): if 0 < n0 and type(log[2](n0), integer)=true then n else end if end proc: seq(a(n), n=1..100); # Emeric Deutsch, Aug 11 2008
MATHEMATICA
Select[Range@ 120, IntegerQ@ Log2@ DigitCount[#, 2, 0] &] (* Michael De Vlieger, Oct 25 2017 *)
PROG
(Haskell)
a143070 n = a143070_list !! (n-1)
a143070_list = filter ((== 1) . a209229 . a023416) [1..]
-- Reinhard Zumkeller, Sep 14 2014
(PARI) ispow2(n) = (n==1) || (n==2) || (ispower(n, , &k) && (k==2));
isok(n) = ispow2(#binary(n) - hammingweight(n)); \\ Michel Marcus, Oct 26 2017
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Jul 22 2008
EXTENSIONS
More terms from Emeric Deutsch, Aug 11 2008
a(61)-a(68) from Ray Chandler, Jun 20 2009
STATUS
approved