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.

Showing 1-5 of 5 results.

A006336 a(n) = a(n-1) + a(n - 1 - number of even terms so far).

Original entry on oeis.org

1, 2, 3, 5, 8, 11, 16, 21, 29, 40, 51, 67, 88, 109, 138, 167, 207, 258, 309, 376, 443, 531, 640, 749, 887, 1054, 1221, 1428, 1635, 1893, 2202, 2511, 2887, 3330, 3773, 4304, 4835, 5475, 6224, 6973, 7860, 8747, 9801, 11022, 12243, 13671, 15306, 16941
Offset: 1

Views

Author

D. R. Hofstadter, Jul 15 1977

Keywords

Comments

From T. D. Noe, Jul 27 2007: (Start)
This is similar to A000123 and A005704, which both have a recursion a(n)=a(n-1)+a([n/k]), where k is 2 and 3, respectively. Those sequences count "partitions of k*n into powers of k". For the present sequence, k=phi. Does A006336(n) count the partitions of n*phi into powers of phi?
Answering my own question: If the recursion starts with a(0)=1, then I think we obtain "number of partitions of n*phi into powers of phi" (see A131882).
Here we need negative powers of phi also: letting p=phi and q=1/phi, we have
n=0: 0*p = {} for 1 partition,
n=1: 1*p = p = 1+q for 2 partitions,
n=2: 2*p = p+p = 1+p+q = 1+1+q+q = p^2+q for 4 partitions, etc.
So the present sequence, which starts with a(1)=1, counts 1/2 of the "number of partitions of n*phi into powers of phi". (End)

Crossrefs

"Number of even terms so far" is A060144(n+1).

Programs

  • Haskell
    a006336 n = a006336_list !! (n-1)
    a006336_list = 1 : h 2 1 0 where
      h n last evens = x : h (n + 1) x (evens + 1 - x `mod` 2) where
        x = last + a006336 (n - 1 - evens)
    -- Reinhard Zumkeller, May 18 2011
  • Maple
    # Maple code for first M terms of a(n) and A060144, from N. J. A. Sloane, Oct 25 2014
    M:=100;
    v[1]:=1; v[2]:=2; w[1]:=0; w[2]:=1;
    for n from 3 to M do
       v[n]:=v[n-1]+v[n-1-w[n-1]];
    if v[n] mod 2 = 0 then w[n]:=w[n-1]+1 else w[n]:=w[n-1]; fi; od:
    [seq(v[n],n=1..M)]; # A006336
    [seq(w[n],n=1..M)]; # A060144 shifted
  • Mathematica
    a[n_Integer] := a[n] = Block[{c, k}, c = 0; k = 1; While[k < n, If[ EvenQ[ a[k] ], c++ ]; k++ ]; Return[a[n - 1] + a[n - 1 - c] ] ]; a[1] = 1; a[2] = 2; Table[ a[n], {n, 0, 60} ]
  • PARI
    A006336(N=99) = local(a=vector(N,i,1), e=0); for(n=2,#a,e+=0==(a[n]=a[n-1]+a[n-1-e])%2);a \\ M. F. Hasler, Jul 23 2007
    

Formula

It seems that A006336 can be generated by a rule using the golden ratio phi: a(n) = a(n-1) + a([n/Phi]) for n>1 with a(1)=1 where phi = (sqrt(5)+1)/2, I.e. the number of even terms up to position n-1 equals n-1 - [n/Phi] for n>1 where Phi = (sqrt(5)+1)/2. (This is true - see the Alekseyev link.) - Paul D. Hanna, Jul 22 2007
a(n) = a(n-1)+a(A060143(n)) for n>1; subsequence of A134409; A134408 and A134409 give first and second differences; A001950(n)=Min(m:A134409(m)=a(n)). - Reinhard Zumkeller, Oct 24 2007

Extensions

More terms from Robert G. Wilson v, Mar 07 2001
Entry revised by N. J. A. Sloane, Oct 25 2014

A046936 Same rule as Aitken triangle (A011971) except a(0,0)=0, a(1,0)=1.

Original entry on oeis.org

0, 1, 1, 1, 2, 3, 3, 4, 6, 9, 9, 12, 16, 22, 31, 31, 40, 52, 68, 90, 121, 121, 152, 192, 244, 312, 402, 523, 523, 644, 796, 988, 1232, 1544, 1946, 2469, 2469, 2992, 3636, 4432, 5420, 6652, 8196, 10142, 12611, 12611, 15080, 18072, 21708, 26140
Offset: 0

Views

Author

Keywords

Examples

			Triangle starts:
0,
1, 1,
1, 2, 3,
3, 4, 6, 9,
9, 12, 16, 22, 31,
31, 40, 52, 68, 90, 121,
121, 152, 192, 244, 312, 402, 523,
523, 644, 796, 988, 1232, 1544, 1946, 2469,
2469, 2992, 3636, 4432, 5420, 6652, 8196, 10142, 12611,
12611, 15080, ...
		

Crossrefs

Borders give A040027. Reading across rows gives A007604.

Programs

  • Haskell
    a046936 n k = a046936_tabl !! n !! k
    a046936_row n = a046936_tabl !! n
    a046936_tabl = [0] : iterate (\row -> scanl (+) (last row) row) [1,1]
    -- Reinhard Zumkeller, Jan 01 2014
    
  • Mathematica
    a[0, 0] = 0; a[1, 0] = 1; a[n_, 0] := a[n, 0] = a[n-1, n-1]; a[n_, k_] := a[n, k] = a[n, k-1] + a[n-1, k-1]; Table[a[n, k], {n, 0, 9}, {k, 0, n}] // Flatten (* Jean-François Alcover, Nov 15 2013 *)
  • Python
    from itertools import accumulate
    def A046936(): # Compare function Gould_diag in A121207.
        yield [0]
        accu = [1, 1]
        while True:
            yield accu
            accu = list(accumulate([accu[-1]] + accu))
    g = A046936()
    [next(g) for  in range(9)] # _Peter Luschny, Apr 25 2016

A249036 a(1)=1, a(2)=2; thereafter a(n) = a(n-1-(number of even terms so far)) + a(n-1-(number of odd terms so far)).

Original entry on oeis.org

1, 2, 2, 3, 4, 4, 5, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 13, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47
Offset: 1

Views

Author

N. J. A. Sloane, Oct 26 2014

Keywords

Comments

Suggested by A006336 and A007604.

Crossrefs

A249037 and A249038 give numbers of even and odd terms so far.

Programs

  • Maple
    M:=100;
    v[1]:=1; v[2]:=2; w[1]:=0; w[2]:=1; x[1]:=1; x[2]:=1;
    for n from 3 to M do
       v[n]:=v[n-1-w[n-1]]+v[n-1-x[n-1]];
    if v[n] mod 2 = 0 then w[n]:=w[n-1]+1; x[n]:=x[n-1];
                      else w[n]:=w[n-1]; x[n]:=x[n-1]+1; fi;
    od:
    [seq(v[n], n=1..M)]; # A249036
    [seq(w[n], n=1..M)]; # A249037
    [seq(x[n], n=1..M)]; # A249038
  • Mathematica
    Nest[Append[#, #[[Length@Select[#, OddQ]]] + #[[Length@Select[#, EvenQ]]]] &, {1, 2}, 75] (* Ivan Neretin, May 02 2016 *)

A249039 a(1)=1, a(2)=2; thereafter a(n) = a(n-1) + a(n-1-(number of even terms so far)) + a(n-1-(number of odd terms so far)).

Original entry on oeis.org

1, 2, 4, 7, 11, 17, 26, 37, 52, 70, 92, 120, 157, 200, 254, 323, 401, 490, 597, 719, 859, 1021, 1211, 1438, 1687, 1979, 2325, 2740, 3183, 3704, 4262, 4863, 5553, 6350, 7201, 8174, 9216, 10336, 11545, 12894, 14350, 15928, 17646, 19526, 21596, 23893, 26352, 29060, 32060, 35406, 39167
Offset: 1

Views

Author

N. J. A. Sloane, Oct 26 2014

Keywords

Comments

Suggested by A006336, A007604 and A249036-A249038.

Crossrefs

A249040 and A249041 give numbers of even and odd terms so far.

Programs

  • Haskell
    import Data.List (genericIndex)
    a249039 n = genericIndex a249039_list (n - 1)
    a249039_list = 1 : 2 : f 2 2 1 1 where
       f x u v w = y : f (x + 1) y (v + 1 - mod y 2) (w + mod y 2)
                   where y = u + a249039 (x - v) + a249039 (x - w)
    -- Reinhard Zumkeller, Nov 11 2014
  • Maple
    M:=100;
    v[1]:=1; v[2]:=2; w[1]:=0; w[2]:=1; x[1]:=1; x[2]:=1;
    for n from 3 to M do
    v[n]:=v[n-1]+v[n-1-w[n-1]]+v[n-1-x[n-1]];
    if v[n] mod 2 = 0 then w[n]:=w[n-1]+1; x[n]:=x[n-1];
    else w[n]:=w[n-1]; x[n]:=x[n-1]+1; fi;
    od:
    [seq(v[n], n=1..M)]; # A249039
    [seq(w[n], n=1..M)]; # A249040
    [seq(x[n], n=1..M)]; # A249041

Formula

For n > 1: a(n+1) = a(n) + a(n - A249040(n)) + a(n - A249041(n)) by mutual recursion. - Reinhard Zumkeller, Nov 11 2014

A060714 a(n) = a(n-1) + a(n-1 minus the number of terms of the same parity as n so far).

Original entry on oeis.org

1, 2, 3, 5, 6, 9, 11, 17, 19, 30, 33, 50, 55, 74, 80, 99, 108, 138, 155, 188, 207, 257, 276, 331, 361, 441, 471, 579, 609, 764, 797, 985, 1018, 1225, 1275, 1551, 1601, 1962, 2017, 2458, 2532, 2973, 3053, 3632, 3731, 4340, 4448, 5057, 5195, 5992
Offset: 1

Views

Author

Robert G. Wilson v, Apr 21 2001

Keywords

Examples

			a(5) = a(4) + a(4 - the number of odd terms so far) = a(4) + a(4-3) = 5 + 1 = 6.
		

Crossrefs

Programs

  • Mathematica
    a[ 1 ] = 1; a[ 2 ] = 2; a[ n_ ] := a[ n ] = Block[ {e = 0}, Do[ If[ EvenQ[ a[ k ] ], e++ ], {k, 1, n - 1} ]; If[ EvenQ[ n ], a[ n - 1 ] + a[ n - 1 - e ], a[ n - 1 ] + a[ e ] ] ]; Table[ a[ n ], {n, 1, 15} ]
Showing 1-5 of 5 results.