login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A070864
a(1) = a(2) = 1; a(n) = 2 + a(n - a(n-1)).
3
1, 1, 3, 3, 3, 5, 3, 5, 5, 5, 7, 5, 7, 5, 7, 7, 7, 9, 7, 9, 7, 9, 7, 9, 9, 9, 11, 9, 11, 9, 11, 9, 11, 9, 11, 11, 11, 13, 11, 13, 11, 13, 11, 13, 11, 13, 11, 13, 13, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 13, 15, 15, 15, 17, 15, 17, 15, 17, 15, 17, 15, 17, 15, 17, 15, 17, 15
OFFSET
1,3
REFERENCES
S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.
FORMULA
Conjecture. Let a(1)=a(2)=1 and for n > 2 let k = floor(sqrt(n+1))-1 and d=n-k(k+2). Then, if (d is 0, 1, or 2) OR (d=0 mod 2), a(n)=2k+1; otherwise a(n)=2k+3. This has been verified for n <= 15000. Thus the asymptotic behavior appears to be a(n) ~ floor(sqrt(n+1)). - John W. Layman, May 21 2002
By induction, a(1)=a(2)=1, a(3)=a(4)=a(5)=3 and for k >= 3 we obtain the following formulas for the 2k-1 consecutive values from a(k^2-2k+2) up to a(k^2+1): a(k^2+1) = a(k^2) = 2k-1, if 1 <= i <= 2k-3 then a(k^2-i) = 2k-2-(-1)^i, hence asymptotically a(n) ~ 2*sqrt(n). - Benoit Cloitre, Jul 28 2002
a(n) = 2*floor(n^(1/2)) + r where r is in {-1,1}. More precisely, let g(n) = round(sqrt(n)) - floor(sqrt(n+1)-1/sqrt(n+1)); then for n >= 1 we get: a(2*n) = 2*floor(sqrt(2*n)) - 2*g(ceiling(n/2)) + 1 and something similar for a(2*n+1). - Benoit Cloitre, Mar 06 2009
a(n) = 2*floor(n^(1/2)) - (-1)^(n + ceiling(n^(1/2))) for n > 0. - Branko Curgus, Feb 10 2011
EXAMPLE
If k = 4, a(4^2+1) = a(17) = a(16) = 2*4 - 1 = 7, a(15) = 2*4 - 2 - (-1)^1 = 7, a(14) = 2*4 - 2 - (-1)^2 = 5, a(13)=7, a(12)=5, a(11)=7.
MATHEMATICA
a[1]=a[2]=1; a[n_]:= a[n]= 2 + a[n -a[n-1]]; Table[a[n], {n, 80}]
PROG
(Sage)
@CachedFunction
def a(n): # A070864
if (n<3): return 1
else: return a(n - a(n-1)) + 2
[a(n) for n in (1..80)] # G. C. Greubel, Mar 28 2022
CROSSREFS
Cf. A004001.
Sequence in context: A132448 A132450 A132424 * A321790 A076566 A083574
KEYWORD
nonn,easy
AUTHOR
N. J. A. Sloane, May 19 2002
EXTENSIONS
More terms from Jason Earls, May 19 2002
STATUS
approved