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.

A074650 Table T(n,k) read by downward antidiagonals: number of Lyndon words (aperiodic necklaces) with n beads of k colors, n >= 1, k >= 1.

Original entry on oeis.org

1, 2, 0, 3, 1, 0, 4, 3, 2, 0, 5, 6, 8, 3, 0, 6, 10, 20, 18, 6, 0, 7, 15, 40, 60, 48, 9, 0, 8, 21, 70, 150, 204, 116, 18, 0, 9, 28, 112, 315, 624, 670, 312, 30, 0, 10, 36, 168, 588, 1554, 2580, 2340, 810, 56, 0, 11, 45, 240, 1008, 3360, 7735, 11160, 8160, 2184, 99, 0
Offset: 1

Views

Author

Christian G. Bower, Aug 28 2002

Keywords

Comments

D. E. Knuth uses the term 'prime strings' for Lyndon words because of the fundamental theorem stating the unique factorization of strings into nonincreasing prime strings (see Knuth 7.2.1.1). With this terminology T(n,k) is the number of k-ary n-tuples (a_1,...,a_n) such that the string a_1...a_n is prime. - Peter Luschny, Aug 14 2012
Also, for k a power of a prime, the number of monic irreducible polynomials of degree n over GF(k). - Andrew Howroyd, Dec 23 2017
An equivalent description: Array read by antidiagonals: T(n,k) = number of conjugacy classes of primitive words of length k >= 1 over an alphabet of size n >= 1.
There are a few incorrect values in Table 1 in the Perrin-Reutenauer paper (Christophe Reutenauer, personal communication), see A294438. - Lars Blomberg, Dec 05 2017
The fact that T(3,4) = 20 coincides with the number of the amino acids encoded by DNA made Francis Crick, John Griffith and Leslie Orgel conjecture in 1957 that the genetic code is a comma-free code, which later turned out to be false. [Hayes] - Andrey Zabolotskiy, Mar 24 2018

Examples

			T(4, 3) counts the 18 ternary prime strings of length 4 which are: 0001, 0002, 0011, 0012, 0021, 0022, 0102, 0111, 0112, 0121, 0122, 0211, 0212, 0221, 0222, 1112, 1122, 1222.
Square array starts:
  1,  2,   3,    4,     5,     6,      7, ...
  0,  1,   3,    6,    10,    15,     21, ...
  0,  2,   8,   20,    40,    70,    112, ...
  0,  3,  18,   60,   150,   315,    588, ...
  0,  6,  48,  204,   624,  1554,   3360, ...
  0,  9, 116,  670,  2580,  7735,  19544, ...
  0, 18, 312, 2340, 11160, 39990, 117648, ...
  ...
The transposed array starts:
   1  0  0     0     0      0       0        0         0          0,
   2  1  2     3     6      9      18       30        56         99,
   3  3  8    18    48    116     312      810      2184       5880,
   4  6  20   60   204    670    2340     8160     29120     104754,
   5 10  40  150   624   2580   11160    48750    217000     976248,
   6 15  70  315  1554   7735   39990   209790   1119720    6045837,
   7 21 112  588  3360  19544  117648   720300   4483696   28245840,
   8 28 168 1008  6552  43596  299592  2096640  14913024  107370900,
   9 36 240 1620 11808  88440  683280  5380020  43046640  348672528,
  10 45 330 2475 19998 166485 1428570 12498750 111111000  999989991,
  11 55 440 3630 32208 295020 2783880 26793030 261994040 2593726344,
  12 66 572 5148 49764 497354 5118828 53745120 573308736 6191711526,
  ...
The initial antidiagonals are:
   1
   2  0
   3  1   0
   4  3   2    0
   5  6   8    3    0
   6 10  20   18    6     0
   7 15  40   60   48     9     0
   8 21  70  150  204   116    18     0
   9 28 112  315  624   670   312    30     0
  10 36 168  588 1554  2580  2340   810    56    0
  11 45 240 1008 3360  7735 11160  8160  2184   99   0
  12 55 330 1620 6552 19544 39990 48750 29120 5880 186 0
		

References

  • F. Bergeron, G. Labelle and P. Leroux, Combinatorial Species and Tree-Like Structures, Cambridge, 1998, p. 97 (2.3.74)
  • Miklos Bona, editor, Handbook of Enumerative Combinatorics, CRC Press, 2015, p. 495.
  • D. E. Knuth, Generating All Tuples and Permutations. The Art of Computer Programming, Vol. 4, Fascicle 2, pp. 26-27, Addison-Wesley, 2005.

Crossrefs

Columns k: A001037 (k=2), A027376 (k=3), A027377 (k=4), A001692 (k=5), A032164 (k=6), A001693 (k=7), A027380 (k=8), A027381 (k=9), A032165 (k=10), A032166 (k=11), A032167 (k=12), A060216 (k=13), A060217 (k=14), A060218 (k=15), A060219 (k=16), A060220 (k=17), A060221 (k=18), A060222 (k=19).
Rows n: A000027 (n=1), A000217(k-1) (n=2), A007290(k+1) (n=3), A006011 (n=4), A208536(k+1) (n=5), A292350 (n=6), A208537(k+1) (n=7).
Cf. A000010, A008683, A075147 (main diagonal), A102659, A215474 (preprime strings), A383011.

Programs

  • Magma
    t:= func< n,k | (&+[MoebiusMu(Floor(n/d))*k^d: d in Divisors(n)])/n >; // array
    A074650:= func< n,k | t(k, n-k+1) >; // downward diagonals
    [A074650(n,k): k in [1..n], n in [1..15]]; // G. C. Greubel, Aug 01 2024
  • Maple
    with(numtheory):
    T:= proc(n, k) add(mobius(n/d)*k^d, d=divisors(n))/n end:
    seq(seq(T(i, 1+d-i), i=1..d), d=1..11);  # Alois P. Heinz, Mar 28 2008
  • Mathematica
    max = 12; t[n_, k_] := Total[ MoebiusMu[n/#]*k^# & /@ Divisors[n]]/n; Flatten[ Table[ t[n-k+1, k], {n, 1, max}, {k, n, 1, -1}]] (* Jean-François Alcover, Oct 18 2011, after Maple *)
  • PARI
    T(n,k)=sumdiv(n,d,moebius(n/d)*k^d)/n \\ Charles R Greathouse IV, Oct 18 2011
    
  • Sage
    # This algorithm generates and counts all k-ary n-tuples (a_1,..,a_n) such
    # that the string a_1...a_n is prime. It is algorithm F in Knuth 7.2.1.1.
    def A074650(n, k):
        a = [0]*(n+1); a[0]=-1
        j = 1; count = 0
        while(j != 0) :
            if j == n : count += 1; # print("".join(map(str,a[1:])))
            else: j = n
            while a[j] >= k-1 : j -= 1
            a[j] += 1
            for i in (j+1..n): a[i] = a[i-j]
        return count   # Peter Luschny, Aug 14 2012
    

Formula

T(n,k) = (1/n) * Sum_{d|n} mu(n/d)*k^d.
T(n,k) = (k^n - Sum_{dAlois P. Heinz, Mar 28 2008
From Richard L. Ollerton, May 10 2021: (Start)
T(n,k) = (1/n)*Sum_{i=1..n} mu(gcd(n,i))*k^(n/gcd(n,i))/phi(n/gcd(n,i)).
T(n,k) = (1/n)*Sum_{i=1..n} mu(n/gcd(n,i))*k^gcd(n,i)/phi(n/gcd(n,i)). (End)
From Seiichi Manyama, Apr 12 2025: (Start)
G.f. of column k: -Sum_{j>=1} mu(j) * log(1 - k*x^j) / j.
Product_{n>=1} 1/(1 - x^n)^T(n,k) = 1/(1 - k*x). (End)

A208535 Square array read by descending antidiagonals: T(n,k) is the number of n-bead necklaces of k colors not allowing reversal, with no adjacent beads having the same color (n, k >= 1).

Original entry on oeis.org

1, 2, 0, 3, 1, 0, 4, 3, 0, 0, 5, 6, 2, 1, 0, 6, 10, 8, 6, 0, 0, 7, 15, 20, 24, 6, 1, 0, 8, 21, 40, 70, 48, 14, 0, 0, 9, 28, 70, 165, 204, 130, 18, 1, 0, 10, 36, 112, 336, 624, 700, 312, 36, 0, 0, 11, 45, 168, 616, 1554, 2635, 2340, 834, 58, 1, 0, 12, 55, 240, 1044, 3360, 7826, 11160
Offset: 1

Views

Author

R. H. Hardin, Feb 27 2012

Keywords

Comments

For prime rows, these appear to be evaluations of Moreau's necklace polynomials at the integers with several combinatorial interpretations (see Wikipedia link). - Tom Copeland, Oct 20 2014
From Petros Hadjicostas, Nov 05 2017: (Start)
The g.f. for column k follows easily from I. Gessel's formulas for this sequence. Since S(1,k) = k-1, we have T(1,k) = k + S(1,k) - (k - 1). Thus, Sum_{n >= 1} T(n,k)*x^n = k*x + Sum_{n >= 1} (1/n)*Sum_{d|n} (k - 1)^d*phi(n/d)*x^n - Sum_{s=0} (k-1)*x^{2*s+1}. Letting m = n/d, we get that (column k g.f.) = k*x - (k - 1)*x/(1 -x^2) + Sum_{m >= 1} (phi(m)/m)*Sum_{d >= 1}((k - 1)*x^m)^d/d. But Sum_{d>=1} z^d/d = -log(1 - z), and so (column k g.f.) = k*x - (k - 1)*x/(1 - x^2) - Sum_{m >= 1} (phi(m)/m)*log(1 - (k - 1)*x^m).
The other formula for the g.f. of column k of this sequence follows from the formula Sum_{n >= 1} (phi(n)/n)*log(1 + t^n) = t/(1 - t^2), which in turn follows from the well-known series Sum_{n >= 1} phi(n)*t^n/(1 + t^n) = t*(1 + t^2)/(1 - t^2)^2.
The extra term k*x in the g.f. for column k is due to the fact that we conventionally assume that a necklace with only one bead, colored with one of the k colors available, is such that there are "no adjacent beads having the same color" (even though, strictly speaking, a single bead is adjacent to itself when we go around the circle of the necklace).
One can use the g.f. for column k to derive the so-called "Empirical for row n" formulae that are denoted by a(k) and given in the formula section below (from n = 1 to n = 7). For example, for n = 3, a(k) = a(k, x=0), where a(k, x) = (1/3!)*d^3/dx^3 (column k g.f.). Here, d^3/dx^3 stands for "third derivative w.r.t. x". If we let f(x) = x/(1 - x^2) and g(x, m) = -log(1 - (k - 1)*x^m), then f^{(3)}(0) = 6, while g^{(3)}(0,m) = 2*(k - 1)^3 for m = 1, 0 for m=2, 6*(k - 1) for m = 3, and 0 for m >= 4. Then, a(k) = (1/6)*(-6*(k - 1) + 2*(k - 1)^3 + (2/3)*6*(k - 1)) = (1/3)*k^3 - k^2 + (2/3)*k. Using this method, one can derive an "Empirical for row n" formula for a(k) for any positive integer n. (End)

Examples

			Table T(n,k) (with rows n >= 1 and columns k >= 1) starts:
  1 2  3   4    5     6      7      8       9      10       11       12       13 ...
  0 1  3   6   10    15     21     28      36      45       55       66       78 ...
  0 0  2   8   20    40     70    112     168     240      330      440      572 ...
  0 1  6  24   70   165    336    616    1044    1665     2530     3696     5226 ...
  0 0  6  48  204   624   1554   3360    6552   11808    19998    32208    49764 ...
  0 1 14 130  700  2635   7826  19684   43800   88725   166870   295526   498004 ...
  0 0 18 312 2340 11160  39990 117648  299592  683280  1428570  2783880  5118828 ...
  0 1 36 834 8230 48915 210126 720916 2097684 5381685 12501280 26796726 53750346 ...
  ...
All solutions for n = 4 and k = 3:
  1    2    1    1    1    1
  3    3    2    2    3    2
  2    2    3    1    1    1
  3    3    2    2    3    3
		

Crossrefs

Columns 3..6: A106365, A106366, A106367, A106368.
Rows 2..7: A000217(n-1), A007290, A006528(n-1), A208536, A006565(n-1), A208537.

Programs

  • Mathematica
    T[n_, k_] := If[n == 1, k, Sum[ EulerPhi[n/d]*(k-1)^d, {d, Divisors[n]}]/n - If[OddQ[n], k-1, 0]]; Table[T[n-k+1, k], {n, 1, 12}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Oct 31 2017, after Andrew Howroyd *)
  • PARI
    T(n,k) = if(n==1, k, sumdiv(n,d,eulerphi(n/d)*(k-1)^d)/n - if(n%2, k-1));
    for(n=1, 10, for(k=1, 10, print1(T(n,k), ", ")); print) \\ Andrew Howroyd, Oct 14 2017

Formula

Let S(n,k) = (1/n) Sum_{d|n} (k-1)^d phi(n/d), where phi is Euler's function.
Then for n even, T(n,k) = S(n,k) and for n > 1 and odd, T(n,k) = S(n,k) - (k-1), and T(1,k) = k. - Ira M. Gessel, Oct 21 2014, Sep 25 2017
Empirical for row n:
n=1: a(k) = k
n=2: a(k) = (1/2)*k^2 - (1/2)*k
n=3: a(k) = (1/3)*k^3 - k^2 + (2/3)*k
n=4: a(k) = (1/4)*k^4 - k^3 + (7/4)*k^2 - k
n=5: a(k) = (1/5)*k^5 - k^4 + 2*k^3 - 2*k^2 + (4/5)*k
n=6: a(k) = (1/6)*k^6 - k^5 + (5/2)*k^4 - (19/6)*k^3 + (7/3)*k^2 - (5/6)*k
n=7: a(k) = (1/7)*k^7 - k^6 + 3*k^5 - 5*k^4 + 5*k^3 - 3*k^2 + (6/7)*k
-----------
From Tom Copeland, Oct 20 2014: (Start)
The first three numbers in each row of the triangular array are given by T(n,k) = (1/k)*(n-k+1)! / (n-2*k+1)!.
For the table here, the first three rows, aside from initial zeros, are given by a(n,k) = (1/n)*(k + 1 - n)! / (k + 1 - 2*n)! or, with no leading zeros, by a(n,k) = (1/n)*(n+k-1)! / (k-1)!. The first three elements of each column correspond to the last three elements of a row in A238363 and the first three of A111492.
Prime rows (> 1) appear to be a(m,n) = (n^m - n)/m. See Wikipedia link. (End)
G.f. for column k: Sum_{n >= 1} T(n,k)*x^n = k*x - Sum_{n >= 1} (phi(n)/n)*((k - 1)*log(1 + x^n) + log(1 - (k - 1)*x^n)) = k*x - (k - 1)*x/(1 - x^2) - Sum_{n >= 1} (phi(n)/n)*log(1 - (k - 1)*x^n). - Petros Hadjicostas, Nov 05 2017

Extensions

Name edited by Petros Hadjicostas, Jun 24 2020

A208536 Number of 5-bead necklaces of n colors not allowing reversal, with no adjacent beads having the same color.

Original entry on oeis.org

0, 0, 6, 48, 204, 624, 1554, 3360, 6552, 11808, 19998, 32208, 49764, 74256, 107562, 151872, 209712, 283968, 377910, 495216, 639996, 816816, 1030722, 1287264, 1592520, 1953120, 2376270, 2869776, 3442068, 4102224, 4859994, 5725824, 6710880
Offset: 1

Views

Author

R. H. Hardin, Feb 27 2012

Keywords

Comments

This sequence would be better defined as a(n) = (n^5-n)/5 with offset 0, which is an integer by Fermat's little theorem. - N. J. A. Sloane, Nov 13 2023

Examples

			All solutions for n=3:
..1....1....1....1....1....1
..3....3....2....2....2....2
..1....2....1....3....3....1
..3....3....3....2....1....2
..2....2....2....3....3....3
		

Crossrefs

Row 5 of A208535.
Also, row 5 (with different offset) of A074650. - Eric M. Schmidt, Dec 08 2017
Cf. A208537.

Programs

Formula

Empirical: a(n) = (1/5)*n^5 - 1*n^4 + 2*n^3 - 2*n^2 + (4/5)*n.
Equivalently: a(n) = ((n-1)^5 - (n-1))/5. - M. F. Hasler, Mar 05 2016
Empirical formula confirmed by Petros Hadjicostas, Nov 05 2017 (see A208535).
a(n+2) = delta(-n) = -delta(n) for n >= 0, where delta is the p-derivation over the integers with respect to prime p = 5. - Danny Rorabaugh, Nov 10 2017
From Colin Barker, Nov 11 2017: (Start)
G.f.: 6*x^3*(1 + x)^2 / (1 - x)^6.
a(n) = 6*a(n-1) - 15*a(n-2) + 20*a(n-3) - 15*a(n-4) + 6*a(n-5) - a(n-6) for n>6.
(End)

A366488 a(n) = (n^11 - n)/11.

Original entry on oeis.org

0, 0, 186, 16104, 381300, 4438920, 32981550, 179756976, 780903144, 2852823600, 9090909090, 25937424600, 67546215516, 162923672184, 368142288150, 786341441760, 1599289640400, 3115626937056, 5842582734474, 10590023536200, 18618181818180, 31843409140200, 53119845582846, 86619068901264, 138334649379000, 216744162819600
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2023

Keywords

Comments

If p is a prime, (n^p-n)/p is an integer by Fermat's Little Theorem. For p = 2, 3, 5, 7, ..., this gives A000217, A007290, A208536, A208537, this sequence, A366489, A366490, A366491.

Crossrefs

Programs

  • Mathematica
    A366488[n_]:=(n^11-n)/11;Array[A366488,30,0] (* Paolo Xausa, Nov 14 2023 *)
    LinearRecurrence[{12,-66,220,-495,792,-924,792,-495,220,-66,12,-1},{0,0,186,16104,381300,4438920,32981550,179756976,780903144,2852823600,9090909090,25937424600},30] (* Harvey P. Dale, Aug 03 2025 *)

Formula

a(n) == 0 (mod 6). - Hugo Pfoertner, Nov 14 2023

A366489 a(n) = (n^13 - n)/13.

Original entry on oeis.org

0, 0, 630, 122640, 5162220, 93900240, 1004668770, 7453000800, 42288908760, 195528140640, 769230769230, 2655593241840, 8230246567620, 23298085122480, 61054982558010, 149707312950720, 346430740566960, 761890617915840, 1601766528128550, 3234844881712080
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2023

Keywords

Comments

See A366488 for further information.

Crossrefs

Programs

Formula

a(n) == 0 (mod 210). - Hugo Pfoertner, Nov 14 2023

A366490 a(n) = (n^17 - n)/17.

Original entry on oeis.org

0, 0, 7710, 7596480, 1010580540, 44878791360, 995685849690, 13684147881600, 132458812569720, 981010688215680, 5882352941176470, 29732178147017280, 130506535690613940, 508847995257725760, 1793608631137129170, 5795654431511374080, 17361641481138401520
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2023

Keywords

Comments

See A366488 for further information.

Crossrefs

Programs

Formula

a(n) == 0 (mod 30), with 30 = A110936(primepi(17)). - Hugo Pfoertner, Nov 14 2023

A366491 a(n) = (n^19 - n)/19.

Original entry on oeis.org

0, 0, 27594, 61171656, 14467258260, 1003867701480, 32071565263710, 599941851861744, 7585009898729256, 71097458824894320, 526315789473684210, 3218899497284976120, 16814736808980154044, 76943173177655058456, 314542313628890231430, 1166756747396368729440, 3976729669784964390480, 12582759772902701307744, 37275544492386193492506, 104127350297911241532840, 275941052631578947368420
Offset: 0

Views

Author

N. J. A. Sloane, Nov 13 2023

Keywords

Comments

See A366488 for further information.

Crossrefs

Programs

Formula

a(n) = 0 (mod 42), with 42 = A110936(primepi(19)). - Hugo Pfoertner, Nov 14 2023

A246445 Numbers of the form (x^y - x)/y for positive x,y.

Original entry on oeis.org

0, 1, 2, 3, 6, 8, 10, 15, 18, 20, 21, 28, 36, 40, 45, 48, 55, 63, 66, 70, 78, 91, 105, 112, 120, 121, 136, 153, 155, 168, 171, 186, 190, 204, 210, 231, 240, 253, 276, 300, 312, 325, 330, 351, 378, 406, 435, 440, 465, 496, 528, 561, 572, 595, 624, 630, 666, 682, 703
Offset: 1

Views

Author

Juri-Stepan Gerasimov, Sep 07 2014

Keywords

Examples

			8 is in this sequence because (3^3 - 3)/3 = 8.
		

Crossrefs

Subsequences of a(n): A000217, A007290, A037205, A208536, A208537.

A208545 Number of 7-bead necklaces of n colors allowing reversal, with no adjacent beads having the same color.

Original entry on oeis.org

0, 0, 9, 156, 1170, 5580, 19995, 58824, 149796, 341640, 714285, 1391940, 2559414, 4482036, 7529535, 12204240, 19173960, 29309904, 43730001, 63847980, 91428570, 128649180, 178168419, 243201816, 327605100, 435965400, 573700725, 747168084
Offset: 1

Views

Author

R. H. Hardin, Feb 27 2012

Keywords

Comments

Row 7 of A208544.

Examples

			All solutions for n=3
..1....1....1....1....1....1....1....1....1
..2....2....2....2....2....2....2....2....2
..3....3....1....1....3....1....3....1....3
..1....1....2....2....1....2....2....3....2
..2....3....3....3....3....1....3....1....3
..3....1....1....2....2....2....2....2....1
..2....3....3....3....3....3....3....3....3
		

Crossrefs

Cf. A208537.

Programs

  • PARI
    Vec(3*x^3*(3 + 28*x + 58*x^2 + 28*x^3 + 3*x^4) / (1 - x)^8 + O(x^40)) \\ Colin Barker, Nov 11 2017

Formula

Empirical: a(n) = (1/14)*n^7 - (1/2)*n^6 + (3/2)*n^5 - (5/2)*n^4 + (5/2)*n^3 - (3/2)*n^2 + (3/7)*n.
From Colin Barker, Nov 11 2017: (Start)
G.f.: 3*x^3*(3 + 28*x + 58*x^2 + 28*x^3 + 3*x^4) / (1 - x)^8.
a(n) = 8*a(n-1) - 28*a(n-2) + 56*a(n-3) - 70*a(n-4) + 56*a(n-5) - 28*a(n-6) + 8*a(n-7) - a(n-8) for n>8.
(End)
Showing 1-9 of 9 results.