cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A070864 a(1) = a(2) = 1; a(n) = 2 + a(n - a(n-1)).

This page as a plain text file.
%I A070864 #43 Feb 16 2025 08:32:46
%S A070864 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,
%T A070864 11,9,11,11,11,13,11,13,11,13,11,13,11,13,11,13,13,13,15,13,15,13,15,
%U A070864 13,15,13,15,13,15,13,15,15,15,17,15,17,15,17,15,17,15,17,15,17,15,17,15
%N A070864 a(1) = a(2) = 1; a(n) = 2 + a(n - a(n-1)).
%D A070864 S. Wolfram, A New Kind of Science, Wolfram Media, 2002; p. 129.
%H A070864 T. D. Noe, <a href="/A070864/b070864.txt">Table of n, a(n) for n = 1..1000</a>
%H A070864 Nick Hobson, <a href="/A070864/a070864.py.txt">Python program for this sequence</a>
%H A070864 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/WolframSequences.html">Wolfram Sequences</a>
%H A070864 <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%F A070864 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
%F A070864 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
%F A070864 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
%F A070864 a(n) = 2*floor(n^(1/2)) - (-1)^(n + ceiling(n^(1/2))) for n > 0. - _Branko Curgus_, Feb 10 2011
%e A070864 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.
%t A070864 a[1]=a[2]=1; a[n_]:= a[n]= 2 + a[n -a[n-1]]; Table[a[n], {n,80}]
%o A070864 (Sage)
%o A070864 @CachedFunction
%o A070864 def a(n): # A070864
%o A070864     if (n<3): return 1
%o A070864     else: return a(n - a(n-1)) + 2
%o A070864 [a(n) for n in (1..80)] # _G. C. Greubel_, Mar 28 2022
%Y A070864 Cf. A004001.
%K A070864 nonn,easy
%O A070864 1,3
%A A070864 _N. J. A. Sloane_, May 19 2002
%E A070864 More terms from _Jason Earls_, May 19 2002