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-3 of 3 results.

A123684 Alternate A016777(n) with A000027(n).

Original entry on oeis.org

1, 1, 4, 2, 7, 3, 10, 4, 13, 5, 16, 6, 19, 7, 22, 8, 25, 9, 28, 10, 31, 11, 34, 12, 37, 13, 40, 14, 43, 15, 46, 16, 49, 17, 52, 18, 55, 19, 58, 20, 61, 21, 64, 22, 67, 23, 70, 24, 73, 25, 76, 26, 79, 27, 82, 28, 85, 29, 88, 30, 91, 31, 94, 32, 97, 33, 100, 34, 103, 35, 106, 36
Offset: 1

Views

Author

Alford Arnold, Oct 11 2006

Keywords

Comments

a(n) is a diagonal of Table A123685.
The arithmetic average of the first n terms gives the positive integers repeated (A008619). - Philippe Deléham, Nov 20 2013
Images under the modified '3x-1' map: a(n) = n/2 if n is even, (3n-1)/2 if n is odd. (In this sequence, the numbers at even indices n are n/2 [A000027], and the numbers at odd indices n are 3((n-1)/2) + 1 [A016777] = (3n-1)/2.) The latter correspondence interestingly mirrors an insight in David Bařina's 2020 paper (see below), namely that 3(n+1)/2 - 1 = (3n+1)/2. - Kevin Ge, Oct 30 2024

Examples

			The natural numbers begin 1, 2, 3, ... (A000027), the sequence 3*n + 1 begins 1, 4, 7, 10, ... (A016777), therefore A123684 begins 1, 1, 4, 2, 7, 3, 10, ...
1/1 = 1, (1+1)/2 = 1, (1+1+4)/3 = 2, (1+1+4+2)/4 = 2, ... - _Philippe Deléham_, Nov 20 2013
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a123684 n = a123684_list !! (n-1)
    a123684_list = concat $ transpose [a016777_list, a000027_list]
    -- Reinhard Zumkeller, Apr 29 2013
    
  • Magma
    &cat[ [ 3*n-2, n ]: n in [1..36] ]; // Klaus Brockhaus, May 12 2007
    
  • Magma
    /* From the fourteenth formula: */ [&+[1+k*(-1)^k: k in [0..n]]: n in [0..80]]; // Bruno Berselli, Jul 16 2013
    
  • Maple
    A123684:=n->n-1/4-(1/2*n-1/4)*(-1)^n: seq(A123684(n), n=1..70); # Wesley Ivan Hurt, Jul 26 2014
  • Mathematica
    CoefficientList[Series[(1 +x +2*x^2)/((1-x)^2*(1+x)^2), {x,0,70}], x] (* Wesley Ivan Hurt, Jul 26 2014 *)
    LinearRecurrence[{0,2,0,-1},{1,1,4,2},80] (* Harvey P. Dale, Apr 14 2025 *)
  • PARI
    print(vector(72, n, if(n%2==0, n/2, (3*n-1)/2))) \\ Klaus Brockhaus, May 12 2007
    
  • PARI
    print(vector(72, n, n-1/4-(1/2*n-1/4)*(-1)^n)); \\ Klaus Brockhaus, May 12 2007
    
  • SageMath
    [(n + (2*n-1)*(n%2))//2 for n in range(1,71)] # G. C. Greubel, Mar 15 2024

Formula

From Klaus Brockhaus, May 12 2007: (Start)
G.f.: x*(1+x+2*x^2)/((1-x)^2*(1+x)^2).
a(n) = (1/4)*(4*n - 1 - (2*n - 1)*(-1)^n).
a(2n-1) = A016777(n-1) = 3(n-1) + 1.
a(2n) = A000027(n) = n.
a(n) = A071045(n-1) + 1.
a(n) = A093005(n) - A093005(n-1) for n > 1.
a(n) = A105638(n+2) - A105638(n+1) for n > 1.
a(n) = A092530(n) - A092530(n-1) - 1.
a(n) = A031878(n+1) - A031878(n) - 1. (End)
a(2*n+1) + a(2*n+2) = A016825(n). - Paul Curtz, Mar 09 2011
a(n)= 2*a(n-2) - a(n-4). - Paul Curtz, Mar 09 2011
From Jaroslav Krizek, Mar 22 2011 (Start):
a(n) = n + a(n-1) for odd n; a(n) = n - A064455(n-1) for even n.
a(n) = A064455(n) - A137501(n).
Abs(a(n) - A064455(n)) = A052928(n). (End)
a(n) = A225126(n) for n > 1. - Reinhard Zumkeller, Apr 29 2013
a(n) = Sum_{k=1..n} (1 + (k-1)*(-1)^(k-1)). - Bruno Berselli, Jul 16 2013
a(n) = n + floor(n/2) for odd n; a(n) = n/2 for even n. - Reinhard Muehlfeld, Jul 25 2014

Extensions

More terms from Klaus Brockhaus, May 12 2007

A031940 Length of longest legal domino snake using full set of dominoes up to [n:n].

Original entry on oeis.org

1, 3, 6, 9, 15, 19, 28, 33, 45, 51, 66, 73, 91, 99, 120, 129, 153, 163, 190, 201, 231, 243, 276, 289, 325, 339, 378, 393, 435, 451, 496, 513, 561, 579, 630, 649, 703, 723, 780, 801, 861, 883, 946, 969, 1035, 1059, 1128, 1153, 1225, 1251, 1326, 1353, 1431, 1459
Offset: 1

Views

Author

Keywords

Examples

			E.g., for n=4 [ 1:1 ][ 1:2 ][ 2:2 ][ 2:3 ][ 3:3 ][ 3:1 ][ 1:4 ][ 4:4 ][ 4:2 ].
		

Crossrefs

Programs

  • Magma
    [((-1)^n*(2 - n) + (2 + n + 2*n^2))/4: n in [1..60]]; // G. C. Greubel, Jun 15 2018
  • Mathematica
    Rest[CoefficientList[Series[x*(1 + 2*x + x^2 - x^3 + x^4)/((1 + x)^2*(1 - x)^3), {x, 0, 50}], x]] (* or *) Table[((-1)^n*(2-n) + (2+n+2*n^2))/4, {n,1, 50}] (* G. C. Greubel, Jun 15 2018 *)
  • PARI
    for(n=1, 60, print1(((-1)^n*(2 - n) + (2 + n + 2*n^2))/4, ", ")) \\ G. C. Greubel, Jun 15 2018
    
  • PARI
    Vec(-x*(1+2*x+x^2-x^3+x^4) / ( (1+x)^2*(x-1)^3 ) + O(x^60)) \\ Felix Fröhlich, Jun 18 2018
    

Formula

C(n, 2) + n if n odd, C(n, 2) + n/2 + 1 if n even. - T. D. Noe, Nov 09 2006
a(n) = A204556(n+1) / (n+1). - Reinhard Zumkeller, Jan 18 2012
G.f.: -x*(1+2*x+x^2-x^3+x^4) / ( (1+x)^2*(x-1)^3 ). - R. J. Mathar, Aug 13 2012
a(n) = ((-1)^n*(2 - n) + (2 + n + 2*n^2))/4. - G. C. Greubel, Jun 15 2018

Extensions

Corrected by T. D. Noe, Nov 09 2006
More terms from Felix Fröhlich, Jun 18 2018

A317612 For k >= 1, fill a k X k square with the numbers 1 to k^2 by rows left to right and top to bottom; then read the square by a square clockwise spiral beginning at the top left and spiraling inwards.

Original entry on oeis.org

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

Views

Author

George E. Laham II and Robert G. Wilson v, Aug 01 2018

Keywords

Comments

Inspired by A317186.
The final term in the k X k spiral is A031878(k+1).

Examples

			  1 => 1;
.
  1---2
      |
  3---4  =>  1, 2, 4, 3;
.
  1---2---3
          |
  4---5   6
  |       |
  7---8---9  =>  1, 2, 3, 6, 9, 8, 7, 4, 5;
.
   1---2---3---4
               |
   5---6---7   8
   |       |   |
   9  10--11  12
   |           |
  13--14--15--16
.
  => 1, 2, 3, 4, 8, 12, 16, 15, 14, 13, 9, 5, 6, 7, 11, 10;
.
   1---2---3---4---5
                   |
   6---7---8---9  10
   |           |   |
  11  12--13  14  15
   |   |       |   |
  16  17--18--19  20
   |               |
  21--22--23--24--25
.
  => 1, 2, 3, 4, 5, 10, 15, 20, 25, 24, 23, 22, 21, 16, 11, 6, 7, 8, 9, 14, 19, 18, 17, 12, 13;
.
   1---2---3---4---5---6
                       |
   7---8---9--10--11  12
   |               |   |
  13  14--15--16  17  18
   |   |       |   |   |
  19  20  21--22  23  24
   |   |           |   |
  25  26--27--28--29  30
   |                   |
  31--32--33--34--35--36
.
  => 1, 2, 3, 4, 5, 6, 12, 18, 24, 30, 36, 35, 34, 33, 32, 31, 25, 19, 13, 7, 8, 9, 10, 11, 17, 23, 29, 28, 27, 26, 20, 14, 15, 16, 22, 21;
		

Crossrefs

Programs

  • Mathematica
    (* To form an n X n square table which begins left to right, then top to bottom *) a[i_, j_, n_] := j + n*(i - 1); f[n_] := Table[ a[i, j, n], {i, n}, {j, n}]
Showing 1-3 of 3 results.