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.

Previous Showing 11-20 of 284 results. Next

A271439 If n is a triangular number, a(n) = 0, otherwise a(n) = n - A002024(n) + 1.

Original entry on oeis.org

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

Views

Author

Peter Kagey, Apr 07 2016

Keywords

Comments

a(n) gives the number above n when the natural numbers are represented as a square array, or 0 if n is in the top row.
1 3 6 10
2 5 9
4 8
7

Examples

			As a regular triangle, sequence begins:
  0;
  0, 1;
  0, 2, 3;
  0, 4, 5, 6;
  0, 7, 8, 9, 10;
  ...
		

Crossrefs

Cf. A000217 (right diagonal), A006003 (row sums).

Programs

  • Mathematica
    Riffle[#, 0] &@ Map[# (# - 1)/2 + Range@ # &, Range[0, 11]] /. {} -> {0} // Flatten (* Michael De Vlieger, Apr 07 2016 *)
  • Python
    from math import isqrt
    def A271439(n): return n-m+(kChai Wah Wu, Nov 07 2024

A064520 a(n) = + 1 - 2 - 3 + 4 + 5 + 6 - 7 - 8 - 9 - 10 + 11 + 12 + 13 + 14 + 15 - ... + (+-1)*n, where there is one plus, two minuses, three pluses, etc. (see A002024).

Original entry on oeis.org

1, -1, -4, 0, 5, 11, 4, -4, -13, -23, -12, 0, 13, 27, 42, 26, 9, -9, -28, -48, -69, -47, -24, 0, 25, 51, 78, 106, 77, 47, 16, -16, -49, -83, -118, -154, -117, -79, -40, 0, 41, 83, 126, 170, 215, 169, 122, 74, 25, -25, -76, -128, -181, -235, -290, -234, -177, -119, -60, 0, 61, 123, 186, 250, 315, 381, 314, 246, 177
Offset: 1

Views

Author

Jonathan Ayres (jonathan.ayres(AT)btinternet.com), Oct 07 2001

Keywords

Comments

|a(n)| takes its locally maximal values when n is a triangular number, the maximal values being given by A019298.
The maximal positive/negative values occur for n = 1, 3, 6, 10, 15, 21 ... the triangular numbers and are a(n) = 1, -4, 11, -23, 42, -69,106, 215, 381, 616 ... +- int(sqrt(n^3/2) + 0.22098 * sqrt(n)). a(n) = n for n = 5, 13, 25, 41, 61, 85, ... m*(m*2-2)+1 and the previous number is equal to 0. Positive numbers which do not occur in this sequence are 2, 3, 6, 7, 8, 10, 12, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 43, 44, 45, 46, 48, ...

Examples

			a(9) = -13 because 1 - 2 - 3 + 4 + 5 + 6 - 7 - 8 - 9 = -13.
		

Crossrefs

Programs

  • Maple
    a := proc(n) option remember: if n=1 then RETURN(1) fi: a(n-1) + n*(-1)^( floor(1/2 + sqrt(2*n)+1)); end: for n from 1 to 150 do printf(`%d,`,a(n)) od:
  • Mathematica
    Accumulate[Flatten[Table[(-1)^(n+1) Range[(n(n-1))/2+1,(n(n+1))/2], {n,15}]]] (* Harvey P. Dale, Apr 22 2015 *)
  • PARI
    t(n) = floor(1/2+sqrt(2*n))
    for(n=1,200,print1(sum(k=1,n,(-1)^(t(k)+1)*k)," "))
    
  • PARI
    t(n)= { floor(sqrt(2*n) + 1/2) }
    { for (n=1, 1000, a=sum(k=1, n, (-1)^(t(k) + 1)*k); write("b064520.txt", n, " ", a) ) } \\ Harry J. Smith, Sep 17 2009
    
  • Python
    from math import isqrt
    def A064520(n): return sum(k if (isqrt(k<<3)+1>>1)&1 else -k for k in range(1,n+1)) # Chai Wah Wu, Oct 16 2022

Formula

a(n) = Sum_{k=1..n} (-1)^(A002024(k)+1)*k.

Extensions

More terms from James Sellers, Jason Earls and Vladeta Jovovic, Oct 08 2001

A180272 a(n) = binomial(n, A002024(n+1)-1) where A002024 is "n appears n times".

Original entry on oeis.org

1, 1, 2, 3, 6, 10, 20, 35, 56, 84, 210, 330, 495, 715, 1001, 3003, 4368, 6188, 8568, 11628, 15504, 54264, 74613, 100947, 134596, 177100, 230230, 296010, 1184040, 1560780, 2035800, 2629575, 3365856, 4272048, 5379616, 6724520, 30260340, 38608020, 48903492
Offset: 0

Views

Author

Paul D. Hanna, Jan 17 2011

Keywords

Comments

Number of subsets of [n] in which exactly half of the elements are triangular numbers: a(6) = 20: {}, {1,2}, {1,4}, {1,5}, {2,3}, {2,6}, {3,4}, {3,5}, {4,6}, {5,6}, {1,2,3,4}, {1,2,3,5}, {1,2,4,6}, {1,2,5,6}, {1,3,4,5}, {1,4,5,6}, {2,3,4,6}, {2,3,5,6}, {3,4,5,6}, {1,2,3,4,5,6}. - Alois P. Heinz, Oct 11 2022

Examples

			G.f.: A(x) = 1 + x + 2*x^2 + 3*x^3 + 6*x^4 + 10*x^5 + 20*x^6 +...
Terms are shown below in parenthesis as they appear in Pascals triangle:
(1);
1,(1);
1,(2),1;
1,3,(3),1;
1,4,(6),4,1;
1,5,(10),5,1;
1,6,15,(20),15,6,1;
1,7,21,(35),35,21,7,1;
1,8,28,(56),70,56,28,8,1;
1,9,36,(84),126,126,84,36,9,1;
1,10,45,120,(210),252,210,120,45,10,1; ...
		

Crossrefs

Programs

  • PARI
    {a(n)=binomial(n,(sqrtint(8*n+1)-1)\2)}
    
  • Python
    from math import comb, isqrt
    def A180272(n): return comb(n,(isqrt(n+1<<3)+1>>1)-1) # Chai Wah Wu, Oct 17 2022

A204169 Array: row n shows the coefficients of the characteristic polynomial of the n-th principal submatrix of (i+j-1), as in A002024.

Original entry on oeis.org

1, -1, -1, -4, 1, 0, 6, 9, -1, 0, 0, -20, -16, 1, 0, 0, 0, 50, 25, -1, 0, 0, 0, 0, -105, -36, 1, 0, 0, 0, 0, 0, 196, 49, -1, 0, 0, 0, 0, 0, 0, -336, -64, 1, 0, 0, 0, 0, 0, 0, 0, 540, 81, -1, 0, 0, 0, 0, 0, 0, 0, 0, -825, -100, 1
Offset: 1

Views

Author

Clark Kimberling, Jan 12 2012

Keywords

Comments

Let p(n)=p(n,x) be the characteristic polynomial of the n-th principal submatrix. The zeros of p(n) are real, and they interlace the zeros of p(n+1). See A202605 and A204016 for guides to related sequences.

Examples

			Top of the array:
2....-1
-1....-4.....1
0.....6.....9....-1
0.....0....-20...-16...1
		

References

  • (For references regarding interlacing roots, see A202605.)

Crossrefs

Programs

  • Mathematica
    f[i_, j_] := i + j - 1;
    m[n_] := Table[f[i, j], {i, 1, n}, {j, 1, n}]
    TableForm[m[8]] (* 8x8 principal submatrix *)
    Flatten[Table[f[i, n + 1 - i],
      {n, 1, 15}, {i, 1, n}]]  (* A002024 *)
    p[n_] := CharacteristicPolynomial[m[n], x];
    c[n_] := CoefficientList[p[n], x]
    TableForm[Flatten[Table[p[n], {n, 1, 10}]]]
    Table[c[n], {n, 1, 12}]
    Flatten[%]                (* A204169 *)
    TableForm[Table[c[n], {n, 1, 10}]]

A004797 Convolution of A002024 with itself.

Original entry on oeis.org

1, 4, 8, 14, 22, 30, 41, 54, 67, 82, 99, 118, 138, 160, 182, 206, 234, 262, 292, 322, 353, 388, 425, 462, 501, 542, 583, 626, 671, 718, 766, 818, 870, 922, 976, 1030, 1088, 1148, 1210, 1274, 1338, 1402, 1469, 1538, 1607, 1678, 1753, 1828, 1905, 1984, 2063
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A002024.

Programs

  • Maple
    a002024:= [seq(i$i,i=1..10)]:
    g002024:= add(a002024[i]*x^(i-1),i=1..nops(a002024)):
    g:= expand(g002024^2):
    seq(coeff(g,x,i),i=0..degree(g002024)); # Robert Israel, May 30 2017
  • PARI
    nn(n)=(sqrtint(n*8)+1)\2;
    a(n) = sum(k=1, n, nn(k)*nn(n-k+1)); \\ Michel Marcus, May 30 2017

Formula

G.f.: (1/(1 - x)^2)*Product_{k>=1} (1 - x^(2*k))^2/(1 - x^(2*k-1))^2. - Ilya Gutkovskiy, May 30 2017

A088673 a(n) = n mod A002024(n), where A002024 is "n appears n times": 1, 2, 2, 3, 3, 3, ...

Original entry on oeis.org

0, 0, 1, 1, 2, 0, 3, 0, 1, 2, 1, 2, 3, 4, 0, 4, 5, 0, 1, 2, 3, 1, 2, 3, 4, 5, 6, 0, 5, 6, 7, 0, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7, 8, 0, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 0, 7, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0, 8, 9, 10, 11, 12, 13, 0, 1, 2
Offset: 1

Views

Author

Gary W. Adamson, Oct 04 2003

Keywords

Examples

			a(7) = 3: A002024(7) = 4 and 7 mod 4 = 3.
		

Crossrefs

Cf. A002024.

Programs

  • Mathematica
    Table[Mod[n,Floor[1/2+Sqrt[2n]]],{n,100}] (* Harvey P. Dale, Feb 09 2013 *)
  • Python
    from math import isqrt
    def A088673(n): return n%((m:=isqrt(k:=n<<1))+(k>m*(m+1))) # Chai Wah Wu, Nov 07 2024

Extensions

Corrected and extended by Ray Chandler, Oct 04 2003
Corrected offset by Chai Wah Wu, Nov 07 2024

A131413 Triangle read by rows: A002024 + A128076 - A000012 as infinite lower triangular matrices.

Original entry on oeis.org

1, 4, 3, 7, 6, 5, 10, 9, 8, 7, 13, 12, 11, 10, 9, 16, 15, 14, 13, 12, 11, 19, 18, 17, 16, 15, 14, 13, 22, 21, 20, 19, 18, 17, 16, 15, 25, 24, 23, 22, 21, 20, 19, 18, 17, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23
Offset: 0

Views

Author

Gary W. Adamson, Jul 08 2007

Keywords

Comments

Row sums = A000566, the heptagonal numbers: (1, 7, 18, 34, 55, ...).

Examples

			First few rows of the triangle:
   1;
   4,  3;
   7,  6,  5;
  10,  9,  8,  7;
  13, 12, 11, 10,  9;
  16, 15, 14, 13, 12, 11;
  19, 18, 17, 16, 15, 14, 13;
  ...
		

Crossrefs

Formula

By rows, (n+1) terms of 3n+1, 3n, 3n-1, ...

Extensions

a(5) = 5, a(30) = 20 corrected and more terms from Georg Fischer, Jun 07 2023

A131901 2*A002024 - A131821.

Original entry on oeis.org

1, 2, 2, 3, 5, 3, 4, 7, 7, 4, 5, 9, 9, 9, 5, 6, 11, 11, 11, 11, 6, 7, 13, 13, 13, 13, 13, 7, 8, 15, 15, 15, 15, 15, 15, 8, 9, 17, 17, 17, 17, 17, 17, 17, 9, 10, 19, 19, 19, 19, 19, 19, 19, 19, 10
Offset: 1

Views

Author

Gary W. Adamson, Jul 26 2007

Keywords

Comments

Row sums = A084849: (1, 4, 11, 22, 37, ...).

Examples

			First few rows of the triangle:
  1;
  2,  2;
  3,  5,  3;
  4,  7,  7,  4;
  5,  9,  9,  9,  5;
  6, 11, 11, 11, 11,  6;
  7, 13, 13, 13, 13, 13,  7;
  ...
		

Crossrefs

Formula

2*A002024 - A131821 as infinite lower triangular matrices.

A131925 2*A002024 - A000012(signed).

Original entry on oeis.org

1, 5, 3, 5, 7, 5, 9, 7, 9, 7, 9, 11, 9, 11, 9, 13, 11, 13, 11, 13, 11, 13, 15, 13, 15, 13, 15, 13, 17, 15, 17, 15, 17, 15, 17, 15, 17, 19, 17, 19, 17, 19, 17, 19, 17
Offset: 0

Views

Author

Gary W. Adamson, Jul 29 2007

Keywords

Comments

Row sums = A077221: (1, 8, 17, 32, 49, 72, 97, ...).

Examples

			First few rows of the triangle:
   1;
   5,  3;
   5,  7,  5;
   9,  7,  9,  7;
   9, 11,  9, 11,  9;
  13, 11, 13, 11, 13, 11;
  13, 15, 13, 15, 13, 15, 13;
  ....
		

Crossrefs

Formula

2*A002024 - A000012 (signed + - + -, ... by columns).
A002024 = (1; 2,2; 3,3,3; ...); A000012(signed) = (1; -1,1; 1,-1,1; ...).

A131948 Triangle T(n,k) = 2*A002024(n+1,k+1) + A007318(n,k) - 2, read by rows.

Original entry on oeis.org

1, 3, 3, 5, 6, 5, 7, 9, 9, 7, 9, 12, 14, 12, 9, 11, 15, 20, 20, 15, 11, 13, 18, 27, 32, 27, 18, 13, 15, 21, 35, 49, 49, 35, 21, 15, 17, 24, 44, 72, 86, 72, 44, 24, 17, 19, 27, 54, 102, 144, 144, 102, 54, 27, 19
Offset: 0

Views

Author

Gary W. Adamson, Jul 30 2007

Keywords

Comments

Row sums = A131949.

Examples

			First few rows of the triangle are:
1;
3, 3;
5, 6, 5;
7, 9, 9, 7;
9, 12, 14, 12, 9;
11, 15, 20, 20, 15, 11;
13, 18, 27, 32, 27, 18, 13;
15, 21, 35, 49, 49, 35, 21, 15;
...
		

Crossrefs

Formula

2*A002024 + A007318 - 2*A000012 as infinite lower triangular matrices.
Previous Showing 11-20 of 284 results. Next