OFFSET
1,3
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Robert Baillie and Thomas Schmelzer, Summing Kempner's Curious (Slowly-Convergent) Series, Mathematica Notebook kempnerSums.nb, Wolfram Library Archive, 2008.
FORMULA
Sum_{n>=2} 1/a(n) = 6.198475910942069028389983717965787117743378665090593775808705963863146498248... (calculated using Baillie and Schmelzer's kempnerSums.nb, see Links). - Amiram Eldar, Feb 13 2022
MATHEMATICA
Select[Range[0, 130], !StringContainsQ[IntegerString[#, 2], "101"] &] (* Amiram Eldar, Feb 13 2022 *)
PROG
(PARI) is(n)=n=binary(n); for(i=3, #n, if(n[i]&&n[i-2]&&!n[i-1], return(0))); 1 \\ Charles R Greathouse IV, Mar 26 2013
(PARI) is(n)=while(n>4, if(bitand(n, 7)==5, return(0)); n>>=1); 1 \\ Charles R Greathouse IV, Feb 11 2017
(PARI) is(n)=!bitand(bitand(n, n>>2), bitneg(n>>1)) \\ Charles R Greathouse IV, Oct 28 2021
(PARI) searchLE(S, x)=my(t=setsearch(S, x)); if(t, t, setsearch(S, x, 1)-1); \\ finds last element <= x
expand(~v, lim)=my(b=exponent(v[#v]+1), B=1<<b, mx=searchLE(v, lim-B), block1=setsearch(v, B\4-1), block2=setsearch(v, B\2)); for(i=1, min(block1, mx), listput(v, B+v[i])); for(i=block2, mx, listput(v, B+v[i])); if(v[#v]>lim, listpop(~v));
list(lim)=lim\=1; if(lim<5, return(if(lim<0, [], [0..lim]))); my(v=List([0..3])); for(b=3, exponent(lim+1), expand(~v, 2^b-1)); expand(~v, lim); Vec(v)
(Haskell)
a004742 n = a004742_list !! (n-1)
a004742_list = filter f [0..] where
f x = x < 4 || x `mod` 8 /= 5 && f (x `div` 2)
-- Reinhard Zumkeller, Jul 01 2013
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved