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-4 of 4 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

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

Original entry on oeis.org

0, 1, 6, 39, 340, 3905, 55986, 960799, 19173960, 435848049, 11111111110, 313842837671, 9726655034460, 328114698808273, 11966776581370170, 469172025408063615, 19676527011956855056, 878942778254232811937, 41660902667961039785742, 2088331858752553232964199
Offset: 0

Views

Author

N. J. A. Sloane, Dec 11 1999

Keywords

Comments

Sum of lengths of longest ending contiguous subsequences with the same value over all s in {1,...,n}^n: a(n) = Sum_{k=1..n} k*A228273(n,k). a(2) = 6 = 2+1+1+2: [1,1], [1,2], [2,1], [2,2]. - Alois P. Heinz, Aug 19 2013
a(n) is the expected wait time to see the contiguous subword 11...1 (n copies of 1) over all infinite sequences on alphabet {1,2,...,n}. - Geoffrey Critzer, May 19 2014
a(n) is the number of sequences of k elements from {1,2,...,n}, where 1<=k<=n. For example, a(2) = 6, counting the sequences, [1], [2], [1,1], [1,2], [2,1], [2,2]. Equivalently, a(n) is the number of bar graphs having a height and width of at most n. - Emeric Deutsch, Jan 24 2017.
In base n, a(n) has n+1 digits: n 1's followed by a 0. - Mathew Englander, Oct 20 2020

Crossrefs

Main diagonal of A228275.

Programs

Formula

a(1)=1; for n!=1 a(n) = (n^(n+1)-1)/(n-1) - 1. - Benoit Cloitre, Aug 17 2002
a(n) = A031973(n)-1 for n>0. - Robert G. Wilson v, Apr 15 2015
a(n) = n*A023037(n) = n^n - 1 + A023037(n). - Mathew Englander, Oct 20 2020

Extensions

a(0)=0 prepended by Alois P. Heinz, Oct 22 2019

A165617 a(n) is the number of positive integers k such that k is equal to the number of 1's in the digits of the base-n expansion of all positive integers <= k.

Original entry on oeis.org

2, 4, 8, 4, 21, 5, 45, 49, 83, 10, 269, 11, 202, 412, 479, 15, 1108, 15, 1545, 1219, 1343, 21, 8944, 706, 1043, 5077, 4084, 28, 27589, 27, 32160, 10423, 6689
Offset: 2

Views

Author

Martin J. Erickson (erickson(AT)truman.edu), Sep 22 2009

Keywords

Comments

The greatest number counted by a(n) is 1...10, where the number of 1's is n-1. - Martin J. Erickson (erickson(AT)truman.edu), Oct 08 2010
These numbers, described in previous comment, 10(2), 110(3), 1110(4), ... expressed in base 10 are: 2, 12, 84, 780, 9330, 137256, 2396744, 48427560, 1111111110, ... - Michel Marcus, Aug 20 2013
The sequence described in the previous two comments is A226238. - Ralf Stephan, Aug 25 2013

Examples

			a(3)=4 since there are four values of k such that k is equal to the number of 1's in the digits of the base-3 expansion of all numbers <= k, namely, 1, 4, 5, 12.
From _Jon E. Schoenfield_, Apr 23 2023: (Start)
In the table below, an asterisk appears on each row k at which the cumulative count of 1's in the base-3 expansion of the positive integers 1..k is equal to k:
.
       k      #1's  cume
  ----------  ----  ----
   1 =   1_3    1     1*
   2 =   2_3    0     1
   3 =  10_3    1     2
   4 =  11_3    2     4*
   5 =  12_3    1     5*
   6 =  20_3    0     5
   7 =  21_3    1     6
   8 =  22_3    0     6
   9 = 100_3    1     7
  10 = 101_3    2     9
  11 = 102_3    1    10
  12 = 110_3    2    12*
(End)
		

Crossrefs

Programs

  • Mathematica
    nn = 7; Table[c = q = 0; Do[c += DigitCount[i, n, 1]; If[c == i, q++], {i, (#^# - #)/(# - 1) &[n]}]; q, {n, 2, nn}] (* Michael De Vlieger, May 24 2023 *)
  • PARI
    a(n) = {my(nmax = (n^n - 1)/(n - 1) - 1, s = 0, nb = 0); for (i=1, nmax, my(digs = digits(i, n)); s += sum (k=1, #digs, (digs[k] == 1)); if (s == i, nb++);); nb;} \\ Michel Marcus, Aug 20 2013; corrected Apr 23 2023

Extensions

Example corrected by Martin J. Erickson (erickson(AT)truman.edu), Sep 25 2009
Definition and a(10) corrected by Tanya Khovanova, Apr 23 2023
a(11)-a(35) from Gregory Marton, Jul 29 2023

A365097 Smallest k > 1 such that the total number of digits "1" required to write the numbers 1..k in base n is equal to k.

Original entry on oeis.org

2, 4, 25, 181, 421, 3930, 8177, 102772, 199981, 3179142, 5971945, 143610511, 210826981, 4754446846, 8589934561, 222195898593, 396718580701, 13494919482970, 20479999999961, 764527028941797, 1168636602822613, 41826814261329722, 73040694872113105, 2855533828630999398
Offset: 2

Views

Author

Andrew Pope, Aug 21 2023

Keywords

Comments

a(10) = A014778(3), being the smallest term > 1 there.
An upper bound is a(n) <= A226238(n) = u, since the digits of u show there are u 1's in numbers 1..u (in base n). - Kevin Ryde, Sep 28 2023

Examples

			For n=2, the first k=2 positive integers are 1 = 1_2 and 2 = 10_2, which have a total of two 1's, so a(2) = 2.
For n=3, the first k=4 positive integers, which are 1_3, 2_3, 10_3, and 11_3, have a total of four 1's, which is equal to k, so a(3) = 4.
For n=4, a total of 25 1's occur in the first k=25 positive integers (they occur in 1_4, 10_4, 11_4, 12_4, 13_4, 21_4, 31_4, 100_4, 101_4, 102_4, 103_4, 110_4, 111_4, 112_4, 113_4, 120_4, and 121_4 = 25), so a(4) = 25.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{k = 1, sum = 1}, While[sum == 1 || sum != k, k++; sum += Count[IntegerDigits[k, n], 1]]; k]; Array[a, 6, 2] (* Amiram Eldar, Aug 29 2023 *)
  • Python
    from itertools import count
    from sympy.ntheory.factor_ import digits
    def A365097(n):
        c, a, q, m = 1, 1, 0, 1
        for k in count(2):
            m += 1
            if m == n:
                m = 0
                q += 1
                a = digits(q,n).count(1)
            elif m==1:
                a += 1
            elif m==2:
                a -= 1
            c += a
            if c == k:
                return k # Chai Wah Wu, Sep 28 2023

Formula

For even n > 2, a(n) = 2*n^(n/2) - 2*n + 1. - Jon E. Schoenfield, Sep 30 2023

Extensions

a(11)-a(15) from Amiram Eldar, Aug 29 2023
a(16)-a(19) from Chai Wah Wu, Sep 29 2023
a(20)-a(25) from Jon E. Schoenfield, Sep 30 2023
Showing 1-4 of 4 results.