OFFSET
0,2
COMMENTS
Let S(n)=sum(k=1,n,a(k)) then it seems that S(n) is asymptotic to 2n. S(n)=2n for many values of n, namely n=10,128,198,199,237,238,241,242,246,247,249,267,329... More generally, starting with (n+2^m-1)/2^m and iterating the same map seems to produce the same kind of behavior for a(n) (i.e. sum(k=1,n,a(k)) is asymptotic to c(m)*n where c(m) depends on m and c(m) is a power of 2).
FORMULA
Special cases: for k>= 0 a(4k+1) = 0, a(16k+10) = a(16k+11) = a(16k+12) = 1.
MATHEMATICA
Table[Length[NestWhileList[# Ceiling[#]&, (n+3)/4, !IntegerQ[#]&]]-1, {n, 110}] (* Harvey P. Dale, Apr 11 2020 *)
PROG
(PARI) a(n)=if(n<0, 0, s=(n+3)/4; c=0; while(frac(s)>0, s=s*ceil(s); c++); c)
CROSSREFS
KEYWORD
nonn
AUTHOR
Benoit Cloitre, Sep 05 2002
STATUS
approved