OFFSET
0,5
REFERENCES
Related problem was offered at XXIX Moscow Mathematical Olympiad (1966).
FORMULA
a(n) = floor(sqrt(A109965(n))) = A109965(n+1)-A109965(n). Roughly (n-log_2(n))/2. 1 appears four times, other powers of 2 appear three times, other numbers appear twice.
From Paul Weisenhorn, Jun 22, Jun 26 2010: (Start)
For n>1, a(n)=2^j+k where j=floor(log_2(n))-1 and k=(n-2^(j+1)-j) mod 2.
a(2^(j+1)+j+2*k) = a(2^(j+1)+j+2*k+1) = 2^j+k; a(2^(j+1)+j-1) = 2^j for all j=0..infinity, k=0..(2^j-1).
(End)
EXAMPLE
a(5) = floor(sqrt(1+1+1+1+2)) = floor(sqrt(8)) = 2.
From Paul Weisenhorn, Jun 22, Jun 26 2010: (Start)
n=21; j=3; k=1; a(21)=2^3+1=9;
j=3; k=4; a(27)=a(28)=12.
(End)
MAPLE
sumr:=0: a(0):=1: for n from 1 to 1000 do sumr:=sumr+a(n-1): a(n):=floor(sqrt(sumr)): end do: # Paul Weisenhorn, Jun 22 2010
a(0..1)=1; for n from 2 to 100 do j:=floor(log[2](n))-1: k:=iquo(n-2^(j+1)-j, 2): a(n):=2^j+k: end do: # Paul Weisenhorn, Jun 26 2010
MATHEMATICA
lst={1}; Nest[AppendTo[lst, Floor[Sqrt[Total[lst]]]]&, 1, 85] (* Harvey P. Dale, May 24 2012 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Henry Bottomley, Jul 06 2005
EXTENSIONS
Formulas corrected by Paul Weisenhorn, Aug 11 2010
Formula a(0..3)=1; a(n)=iquo(n+1-floor(log[2](n-2)),2); n=4..infinity; deleted and second Maple program changed Paul Weisenhorn, Aug 22 2010
STATUS
approved