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.

A005230 Stern's sequence: a(1) = 1, a(n+1) is the sum of the m preceding terms, where m*(m-1)/2 < n <= m*(m+1)/2 or equivalently m = ceiling((sqrt(8*n+1)-1)/2) = A002024(n).

This page as a plain text file.
%I A005230 M0785 #70 Apr 12 2024 01:41:26
%S A005230 1,1,2,3,6,11,20,40,77,148,285,570,1120,2200,4323,8498,16996,33707,
%T A005230 66844,132568,262936,521549,1043098,2077698,4138400,8243093,16419342,
%U A005230 32706116,65149296,130298592,260075635,519108172,1036138646,2068138892,4128034691
%N A005230 Stern's sequence: a(1) = 1, a(n+1) is the sum of the m preceding terms, where m*(m-1)/2 < n <= m*(m+1)/2 or equivalently m = ceiling((sqrt(8*n+1)-1)/2) = A002024(n).
%C A005230 A002487 is THE Stern's sequence!
%C A005230 Limit_{n->oo} a(n)/2^n = 0.11756264240558743281779408719593950494049225979176... - _Jon E. Schoenfield_, Dec 17 2016
%D A005230 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A005230 Harvey P. Dale, <a href="/A005230/b005230.txt">Table of n, a(n) for n = 1..1000</a> [extending prior submission by T. D. Noe]
%H A005230 Jaegug Bae and Sungjin Choi, <a href="https://doi.org/10.4134/JKMS.2003.40.5.757">A generalization of a subset-sum-distinct sequence</a>, J. Korean Math. Soc. 40 (2003), no. 5, 757-768. MR1996839 (2004d:05198). See d_1(n).
%H A005230 G. Kreweras, <a href="http://www.numdam.org/item?id=MSH_1983__84__45_0">Sur quelques problèmes relatifs au vote pondéré</a>, [Some problems of weighted voting], Math. Sci. Humaines No. 84 (1983), 45-63.
%H A005230 M. A. Stern, <a href="http://dx.doi.org/10.1515/crll.1838.18.100">Aufgaben</a>, J. Reine Angew. Math., 18 (1838), 100.
%H A005230 <a href="/index/St#Stern">Index entries for sequences related to Stern's sequences</a>
%H A005230 <a href="/index/Cor#core">Index entries for "core" sequences</a>
%F A005230 Partial sums give Conway-Guy sequence A005318. Cf. A066777.
%F A005230 2*a(n*(n+1)/2 + 1) = a(n*(n+1)/2 + 2) for n>=1; lim_{n->oo} a(n+1)/a(n) = 2. - _Paul D. Hanna_, Aug 28 2006
%p A005230 A005230[1] := 1: n := 50: for k from 1 to n-1 do: A005230[k+1] := sum('A005230[j]','j'=k+1-(ceil((sqrt(8*k+1)-1)/2))..k): od: [seq(A005230[k],k=1..n)]; # UlrSchimke(AT)aol.com, Mar 16 2002
%t A005230 Module[{lst={1,1},n=2},While[n<40,AppendTo[lst,Total[ Take[lst, -Ceiling[ (Sqrt[8n+1]-1)/2]]]];n++];lst] (* _Harvey P. Dale_, Apr 02 2012 *)
%o A005230 (PARI) a(n)=if(n==1,1,sum(k=1,ceil((sqrt(8*n-7)-1)/2),a(n-k))) \\ _Paul D. Hanna_, Aug 28 2006
%o A005230 (PARI) v=vector(10^3);v[1]=v[2]=1;v[3]=2;v[4]=3;u=vector(#v,i,if(i>4,0,sum(j=1,i,v[j])));for(i=5,#v,m=ceil((sqrt(8*i-7)-1)/2);v[i]=u[i-1]-u[i-m-1];u[i]=u[i-1]+v[i]);u=0;v \\ _Charles R Greathouse IV_, Sep 19 2011
%o A005230 (Python)
%o A005230 from itertools import count, islice
%o A005230 from math import isqrt
%o A005230 def A005230_gen(): # generator of terms
%o A005230     blist = [1]
%o A005230     for n in count(1):
%o A005230         yield blist[-1]
%o A005230         blist.append(sum(blist[-i] for i in range(1,(isqrt(8*n)+3)//2)))
%o A005230 A005230_list = list(islice(A005230_gen(),30)) # _Chai Wah Wu_, Feb 02 2022
%Y A005230 Cf. A002487.
%K A005230 core,easy,nonn,nice
%O A005230 1,3
%A A005230 _N. J. A. Sloane_, _Simon Plouffe_
%E A005230 Name corrected by Mario Szegedy, Sep 15 1996
%E A005230 Name revised by Ulrich Schimke (ulrschimke(AT)aol.com), Mar 16 2002