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

A228275 A(n,k) = Sum_{i=1..k} n^i; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 3, 6, 3, 0, 0, 4, 14, 12, 4, 0, 0, 5, 30, 39, 20, 5, 0, 0, 6, 62, 120, 84, 30, 6, 0, 0, 7, 126, 363, 340, 155, 42, 7, 0, 0, 8, 254, 1092, 1364, 780, 258, 56, 8, 0, 0, 9, 510, 3279, 5460, 3905, 1554, 399, 72, 9, 0
Offset: 0

Views

Author

Alois P. Heinz, Aug 19 2013

Keywords

Comments

A(n,k) is the total sum of lengths of longest ending contiguous subsequences with the same value over all s in {1,...,n}^k:
A(4,1) = 4 = 1+1+1+1: [1], [2], [3], [4].
A(1,4) = 4: [1,1,1,1].
A(3,2) = 12 = 2+1+1+1+2+1+1+1+2: [1,1], [1,2], [1,3], [2,1], [2,2], [2,3], [3,1], [3,2], [3,3].
A(2,3) = 14 = 3+1+1+2+2+1+1+3: [1,1,1], [1,1,2], [1,2,1], [1,2,2], [2,1,1], [2,1,2], [2,2,1], [2,2,2].

Examples

			Square array A(n,k) begins:
  0, 0,  0,   0,    0,     0,      0,      0, ...
  0, 1,  2,   3,    4,     5,      6,      7, ...
  0, 2,  6,  14,   30,    62,    126,    254, ...
  0, 3, 12,  39,  120,   363,   1092,   3279, ...
  0, 4, 20,  84,  340,  1364,   5460,  21844, ...
  0, 5, 30, 155,  780,  3905,  19530,  97655, ...
  0, 6, 42, 258, 1554,  9330,  55986, 335922, ...
  0, 7, 56, 399, 2800, 19607, 137256, 960799, ...
		

Crossrefs

Rows n=0-11 give: A000004, A001477, A000918(k+1), A029858(k+1), A080674, A104891, A105281, A104896, A052379(k-1), A052386, A105279, A105280.
Main diagonal gives A031972.
Lower diagonal gives A226238.
Cf. A228250.

Programs

  • Maple
    A:= (n, k)-> `if`(n=1, k, (n/(n-1))*(n^k-1)):
    seq(seq(A(n, d-n), n=0..d), d=0..12);
  • Mathematica
    a[0, 0] = 0; a[1, k_] := k; a[n_, k_] := n*(n^k-1)/(n-1); Table[a[n-k, k], {n, 0, 12}, {k, n, 0, -1}] // Flatten (* Jean-François Alcover, Dec 16 2013 *)

Formula

A(1,k) = k, else A(n,k) = n/(n-1)*(n^k-1).
A(n,k) = Sum_{i=1..k} n^i.
A(n,k) = Sum_{i=1..k+1} binomial(k+1,i)*A(n-i,k)*(-1)^(i+1) for n>k, given values A(0,k), A(1,k),..., A(k,k). - Yosu Yurramendi, Sep 03 2013

A031973 a(n) = Sum_{k=0..n} n^k.

Original entry on oeis.org

1, 2, 7, 40, 341, 3906, 55987, 960800, 19173961, 435848050, 11111111111, 313842837672, 9726655034461, 328114698808274, 11966776581370171, 469172025408063616, 19676527011956855057, 878942778254232811938, 41660902667961039785743, 2088331858752553232964200
Offset: 0

Views

Author

Keywords

Comments

These are the generalized repunits of length n+1 in base n for all n >= 1: a(n) expressed in base n is 111...111 (n+1 1's): a(1) = 1^0 + 1^1 = 2 = A000042(2), a(2) = 2^0 + 2^1 + 2^2 = 7 = A000225(3), a(3) = 3^0 + 3^1 + 3^2 + 3^3 = 40 = A003462(4), etc., a(10) = 10^0 + 10^1 + 10^2 + ... + 10^9 + 10^10 = 11111111111 = A002275(11), etc. - Rick L. Shepherd, Aug 26 2004
a(n)=the total number of ordered selections of up to n objects from n types with repetitions allowed. Thus for 2 objects a,b there are 7 possible selections: aa,bb,ab,ba,a,b, and the null set. - J. M. Bergot, Mar 26 2014
a(n)=the total number of ordered arrangements of 0,1,2..n objects, with repetitions allowed, selected from n types of objects. - J. M. Bergot, Apr 11 2014

Examples

			a(3) = 3^0 + 3^1 + 3^2 + 3^3 = 40.
		

Crossrefs

Cf. A000042 (unary representations), A000225 (2^n-1: binary repunits shown in decimal), A003462 ((3^n-1)/2: ternary repunits shown in decimal), A002275 ((10^n-1)/9: decimal repunits).
Cf. A104878.

Programs

  • Magma
    [&+[n^k: k in [0..n]]: n in [0..30]]; // Vincenzo Librandi, Apr 18 2011
    
  • Maple
    a:= proc(n) local c, i; c:=1; for i to n do c:= c*n+1 od; c end:
    seq(a(n), n=0..20); # Alois P. Heinz, Aug 15 2013
  • Mathematica
    Join[{1},Table[Total[n^Range[0,n]],{n,20}]] (* Harvey P. Dale, Nov 13 2011 *)
  • PARI
    a(n)=(n^(n+1)-1)/(n-1) \\ Charles R Greathouse IV, Mar 26 2014
  • Sage
    [lucas_number1(n,n,n-1) for n in range(1, 19)] # Zerinvary Lajos, May 16 2009
    

Formula

a(n) = (n^(n+1)-1)/(n-1) = (A007778(n)-1)/(n-1) = A023037(n)+A000312(n) = A031972(n)+1. - Henry Bottomley, Apr 04 2003
a(n) = A125118(n,n-2) for n>2. - Reinhard Zumkeller, Nov 21 2006
a(n) = [x^n] 1/((1 - x)*(1 - n*x)). - Ilya Gutkovskiy, Oct 04 2017
a(n) = A104878(2n,n). - Alois P. Heinz, May 04 2021

A228273 T(n,k) is the number of s in {1,...,n}^n having longest ending contiguous subsequence with the same value of length k; triangle T(n,k), n>=0, 0<=k<=n, read by rows.

Original entry on oeis.org

1, 0, 1, 0, 2, 2, 0, 18, 6, 3, 0, 192, 48, 12, 4, 0, 2500, 500, 100, 20, 5, 0, 38880, 6480, 1080, 180, 30, 6, 0, 705894, 100842, 14406, 2058, 294, 42, 7, 0, 14680064, 1835008, 229376, 28672, 3584, 448, 56, 8, 0, 344373768, 38263752, 4251528, 472392, 52488, 5832, 648, 72, 9
Offset: 0

Views

Author

Alois P. Heinz, Aug 19 2013

Keywords

Examples

			T(0,0) = 1: [].
T(1,1) = 1: [1].
T(2,1) = 2: [1,2], [2,1].
T(2,2) = 2: [1,1], [2,2].
T(3,1) = 18: [1,1,2], [1,1,3], [1,2,1], [1,2,3], [1,3,1], [1,3,2], [2,1,2], [2,1,3], [2,2,1], [2,2,3], [2,3,1], [2,3,2], [3,1,2], [3,1,3], [3,2,1], [3,2,3], [3,3,1], [3,3,2].
T(3,2) = 6: [1,2,2], [1,3,3], [2,1,1], [2,3,3], [3,1,1], [3,2,2].
T(3,3) = 3: [1,1,1], [2,2,2], [3,3,3].
Triangle T(n,k) begins:
  1;
  0,        1;
  0,        2,       2;
  0,       18,       6,      3;
  0,      192,      48,     12,     4;
  0,     2500,     500,    100,    20,    5;
  0,    38880,    6480,   1080,   180,   30,   6;
  0,   705894,  100842,  14406,  2058,  294,  42,  7;
  0, 14680064, 1835008, 229376, 28672, 3584, 448, 56,  8;
		

Crossrefs

Row sums give: A000312.
Columns k=0-4 give: A000007, A066274(n) = 2*A081131(n) for n>1, A053506(n) for n>2, A055865(n-1) = A085389(n-1) for n>3, A085390(n-1) for n>4.
Main diagonal gives: A028310.
Lower diagonals include (offsets may differ): A002378, A045991, A085537, A085538, A085539.

Programs

  • Maple
    T:= (n, k)-> `if`(n=0 and k=0, 1, `if`(k<1 or k>n, 0,
                 `if`(k=n, n, (n-1)*n^(n-k)))):
    seq(seq(T(n,k), k=0..n), n=0..12);
  • Mathematica
    f[0,0]=1;
    f[n_,k_]:=Which[1<=k<=n-1,n^(n-k)*(n-1),k<1,0,k==n,n,k>n,0];
    Table[Table[f[n,k],{k,0,n}],{n,0,10}]//Grid (* Geoffrey Critzer, May 19 2014 *)

Formula

T(0,0) = 1, else T(n,k) = 0 for k<1 or k>n, else T(n,n) = n, else T(n,k) = (n-1)*n^(n-k).
Sum_{k=0..n} T(n,k) = A000312(n).
Sum_{k=0..n} k*T(n,k) = A031972(n).

A068475 a(n) = Sum_{m=0..n} m*n^(m-1).

Original entry on oeis.org

0, 1, 5, 34, 313, 3711, 54121, 937924, 18831569, 429794605, 10987654321, 310989720966, 9652968253897, 326011399456939, 11901025061692313, 466937872906120456, 19594541482740368161, 875711370981239308953, 41524755927216069067489, 2082225625247428808306410
Offset: 0

Views

Author

Francois Jooste (phukraut(AT)hotmail.com), Mar 10 2002

Keywords

Comments

The closed form comes from taking the derivative of the closed form of A031972, for which each term of this sequence is a derivative. - Jonas Whidden, Oct 18 2011

Examples

			a(2) = Sum_{m = 1..2} m*2^(m-1) = 1 + 2*2 = 5.
		

Crossrefs

Derivative sequence of A031972.

Programs

  • Haskell
    a068475 n = sum $ zipWith (*) [1..n] $ iterate (* n) 1
    -- Reinhard Zumkeller, Nov 22 2014
    
  • Magma
    [0] cat [(&+[m*n^(m-1): m in [0..n]]): n in [1..30]]; // G. C. Greubel, Oct 13 2018
  • Maple
    a := n->sum(m*n^(m-1),m=1..n);
  • Mathematica
    Join[{0}, Table[Sum[m*n^(m-1), {m,0,n}], {n,1,30}]] (* G. C. Greubel, Oct 13 2018 *)
  • PARI
    for(n=0,30, print1(if(n==0, 0, sum(m=0,n, m*n^(m-1))), ", ")) \\ G. C. Greubel, Oct 13 2018
    

Formula

a(1) = 1. For n > 1, a(n) = ((n-1)*(n+1)*n^n - n^(n+1) + 1)/(n-1)^2. - Jonas Whidden, Oct 18 2011
a(n) = A062806(n) / n for n>=1. - Reinhard Zumkeller, Nov 22 2014
a(n) = [x^(n-1)] 1/((1 - x)*(1 - n*x)^2). - Peter Bala, Feb 12 2024

A117667 a(n) = n^n-n^(n-1)-n^(n-2)-n^(n-3)-...-n^3-n^2-n.

Original entry on oeis.org

1, 2, 15, 172, 2345, 37326, 686287, 14380472, 338992929, 8888888890, 256780503551, 8105545862052, 277635514376233, 10257237069745862, 406615755353655135, 17216961135462248176, 775537745518440716417
Offset: 1

Views

Author

Luc Stevens (lms022(AT)yahoo.com), Apr 11 2006

Keywords

Examples

			a(3) = 3^3-3^2-3 = 27-9-3 = 15.
		

Crossrefs

Cf. A000312 (n^n), A023037 (1+n+n^2+...n^(n-1)),

Programs

  • Maple
    a:=n->n^n-sum(n^j,j=1..n-1): seq(a(n),n=1..19); # Emeric Deutsch, Apr 16 2006
  • Mathematica
    s[n_] := Sum[n^i, {i, 1, n - 1}]; Table[n^n - s[n], {n, 17}] (* Carlos Eduardo Olivieri, Apr 14 2015 *)
    f[n_] := ((n - 2) n^n + n)/(n - 1); f[1] = 1; Array[f, 18] (* Robert G. Wilson v, Apr 15 2015 *)

Formula

a(n) = A000312(n) - A023037(n) + 1. - Michel Marcus, Apr 14 2015
A191690(n)+1. - Robert G. Wilson v, Apr 16 2015

A332652 a(n) = Sum_{k=1..n} n^(k/gcd(n, k)).

Original entry on oeis.org

1, 4, 15, 76, 785, 7836, 137263, 2130976, 47895489, 1010012140, 28531167071, 743044702104, 25239592216033, 797785008119932, 31147773583464735, 1157442765678719056, 51702516367896047777, 2185932446984222457444, 109912203092239643840239, 5255987282125826560192520
Offset: 1

Views

Author

Ilya Gutkovskiy, Feb 18 2020

Keywords

Crossrefs

Programs

  • Magma
    [&+[n^(k div Gcd(n,k)):k in [1..n]]:n in [1..21]]; // Marius A. Burtea, Feb 18 2020
  • Mathematica
    Table[Sum[n^(k/GCD[n, k]), {k, 1, n}], {n, 1, 20}]
    Table[Sum[Sum[If[GCD[k, d] == 1, n^k, 0], {k, 1, d}], {d, Divisors[n]}], {n, 1, 20}]

Formula

a(n) = Sum_{k=1..n} n^(lcm(n, k)/n).
a(n) = Sum_{d|n} Sum_{k=1..d, gcd(k, d) = 1} n^k.
a(n) = n * A332653(n).

A229896 Sizes of logical groups of the same integer in A229895.

Original entry on oeis.org

1, 1, 4, 1, 5, 27, 1, 7, 37, 256, 1, 9, 61, 369, 3125, 1, 11, 91, 671, 4651, 46656, 1, 13, 127, 1105, 9031, 70993, 823543, 1, 15, 169, 1695, 15961, 144495, 1273609, 16777216, 1, 17, 217, 2465, 26281, 269297, 2685817, 26269505, 387420489, 1, 19, 271, 3439
Offset: 1

Views

Author

Carl R. White, Oct 03 2013

Keywords

Comments

The two ones at the start of the parent sequence represent parent and child 1-tuples in the grandparent sequence [(1) and (2) respectively], hence this sequence also starts with 1, 1 rather than 2, which would otherwise be a more sensible way to describe the pair of ones.
All other elements are effectively run-lengths of strings of the same integer in A229895.
The first occurrence of an integer, n, in the parent sequence, is the first of a run of n^n elements of value n. For later occurrences, the run length is n^k-(n-1)^k where k is the size of the k-tuple in the grandparent sequence, A229873.
The elements can be arranged into a triangle thus:
.... 1
.... 1, 4
.... 1, 5, 27
.... 1, 7, 37, 256
.... 1, 9, 61, 369, 3125
.... etc.
where the n-th line is:
.... n^1-(n-1)^1, n^2-(n-1)^2, ..., n^(k-1)-(n-1)^(k-1), n^n; 1 <= k < n
The first terms, for sufficiently large n simplifying as:
.... 1, 2n-1, 3n^2-3n+1, 4n^3-6n^2+4n-1, etc.
Row sums are first differences of A031972, and thus the cumulative sum of rows at the end of each row is A031972 itself, i.e., n*(n^n - 1)/(n-1).

Crossrefs

Programs

  • Maple
    T := proc (n, k) if k < n then n^k-(n-1)^k elif k = n then n^n else end if end proc: for n to 12 do seq(T(n, k), k = 1 .. n) end do; # yields sequence in triangular form - Emeric Deutsch, Jan 30 2017
  • bc
    /* GNU bc */ for(n=1;n<=10;n++)for(p=1;p<=n;p++){if(p==n){t=n^n}else{t=n^p-(n-1)^p};print t,","};print "...\n"

A088055 a(n) = n!*n^n - ((n^(n+1)-1)/(n-1) - 1) for n>1 with a(1)=0.

Original entry on oeis.org

0, 2, 123, 5804, 371095, 33536334, 4149695921, 676438175160, 140586711200271, 36287988888888890, 11388728579602327129, 4270826370748686175140, 1886009588224061851054127, 968725766842917544760889030
Offset: 1

Views

Author

Amarnath Murthy, Sep 20 2003

Keywords

Comments

Original definition: a(n) = G(n) - A(n), where G(n) = Sum of the first n terms of a geometric progression with first term n and common ratio n. A(n) = Product of first n terms of an arithmetic progression with first term n and common difference n.

Crossrefs

Programs

  • Maple
    seq(`if`(n=1, 0, n!*n^n - ((n^(n+1)-1)/(n-1) - 1)),n=1..16); # Georg Fischer, Dec 09 2022
  • PARI
    a(n) = if (n==1, 0, n!*n^n - ((n^(n+1)-1)/(n-1) - 1)); \\ Michel Marcus, Dec 10 2022

Formula

a(n) = A061711(n) - A031972(n) for n>1 with a(1)=0.

Extensions

Corrected and extended by David Wasserman, Jun 27 2005
Edited by M. F. Hasler, Feb 12 2013
Formula negated by Georg Fischer, Dec 09 2022

A264748 a(n) = Sum_{k = 1..n} (k^n - n^k).

Original entry on oeis.org

0, -1, -3, 14, 520, 11185, 239505, 5510652, 138456936, 3803230815, 113833152565, 3695302326650, 129479186068128, 4874312730972685, 196306448145080385, 8425000059348756472, 383956514250037779376, 18521535576956405481147, 942952190208348285876501
Offset: 1

Views

Author

Ilya Gutkovskiy, Nov 23 2015

Keywords

Examples

			a(1) = 1^1 - 1^1 = 0;
a(2) = 1^2 - 2^1 + 2^2 - 2^2 = -1;
a(3) = 1^3 - 3^1 + 2^3 - 3^2 + 3^3 - 3^3 = -3;
a(4) = 1^4 - 4^1 + 2^4 - 4^2 + 3^4 - 4^3 + 4^4 - 4^4 = 14;
a(5) = 1^5 - 5^1 + 2^5 - 5^2 + 3^5 - 5^3 + 4^5 - 5^4 + 5^5 - 5^5 = 520, etc.
		

Crossrefs

Programs

  • Mathematica
    Table[Sum[k^n - n^k, {k, 1, n}], {n, 1, 20}]
    Join[{0}, Table[HarmonicNumber[n, -n] - n (n^n - 1)/(n - 1), {n, 2, 20}]]
  • PARI
    a(n) = sum(k=1, n, k^n - n^k); \\ Altug Alkan, Nov 23 2015

Formula

a(n) = A031971(n) - A031972(n).
a(n) = ((1 - n)*zeta(-n, n + 1) - n*(n^n - 1) + (n - 1)*zeta(-n))/(n - 1) for n>1, where zeta(s) is the Riemann zeta function and zeta(s, a) is the Hurwitz zeta function.
a(n) ~ n^n / (exp(1) - 1). - Vaclav Kotesovec, Jul 16 2025
Showing 1-9 of 9 results.