A143324 Table T(n,k) by antidiagonals. T(n,k) is the number of length n primitive (=aperiodic or period n) k-ary words (n,k >= 1).
1, 2, 0, 3, 2, 0, 4, 6, 6, 0, 5, 12, 24, 12, 0, 6, 20, 60, 72, 30, 0, 7, 30, 120, 240, 240, 54, 0, 8, 42, 210, 600, 1020, 696, 126, 0, 9, 56, 336, 1260, 3120, 4020, 2184, 240, 0, 10, 72, 504, 2352, 7770, 15480, 16380, 6480, 504, 0, 11, 90, 720, 4032, 16800, 46410, 78120, 65280, 19656, 990, 0
Offset: 1
Examples
T(2,3)=6, because there are 6 primitive words of length 2 over 3-letter alphabet {a,b,c}: ab, ac, ba, bc, ca, cb; note that the non-primitive words aa, bb and cc don't belong to the list; secondly note that the words in the list need not be Lyndon words, for example ba can be derived from ab by a cyclic rotation of the positions. Table begins: 1, 2, 3, 4, 5, ... 0, 2, 6, 12, 20, ... 0, 6, 24, 60, 120, ... 0, 12, 72, 240, 600, ... 0, 30, 240, 1020, 3120, ...
Links
- Alois P. Heinz, Antidiagonals n = 1..141, flattened
- C. J. Smyth, A coloring proof of a generalisation of Fermat's little theorem, Amer. Math. Monthly 93, No. 6 (1986), pp. 469-471.
- Lucas Vieira Barbosa, Nonclassical Temporal Correlations Under Finite-Memory Constraints, Doctoral Thesis, Univ. Wien (Austria 2024). See p. 35.
- Index entries for sequences related to Lyndon words
Crossrefs
Programs
-
Maple
with(numtheory): f0:= proc(n) option remember; unapply(k^n-add(f0(d)(k), d=divisors(n)minus{n}), k) end; T:= (n,k)-> f0(n)(k); seq(seq(T(n, 1+d-n), n=1..d), d=1..12);
-
Mathematica
f0[n_] := f0[n] = Function [k, k^n - Sum[f0[d][k], {d, Complement[Divisors[n], {n}]}]]; t[n_, k_] := f0[n][k]; Table[Table[t[n, 1 + d - n], {n, 1, d}], {d, 1, 12}] // Flatten (* Jean-François Alcover, Dec 12 2013, translated from Maple *)
Formula
T(n,k) = Sum_{d|n} k^d * mu(n/d).
T(n,k) = k^n - Sum_{d
T(n,k) = A143325(n,k) * k.
T(n,k) = A074650(n,k) * n.
So Sum_{d|n} k^d * mu(n/d) == 0 (mod n), this is a generalization of Fermat's little theorem k^p - k == 0 (mod p) for primes p to an arbitrary modulus n (see the Smyth link). - Franz Vrabec, Feb 09 2021
A363916 Array read by descending antidiagonals. A(n, k) = Sum_{d=0..k} A363914(k, d) * n^d.
1, 0, 1, 0, 1, 1, 0, 0, 2, 1, 0, 0, 2, 3, 1, 0, 0, 6, 6, 4, 1, 0, 0, 12, 24, 12, 5, 1, 0, 0, 30, 72, 60, 20, 6, 1, 0, 0, 54, 240, 240, 120, 30, 7, 1, 0, 0, 126, 696, 1020, 600, 210, 42, 8, 1, 0, 0, 240, 2184, 4020, 3120, 1260, 336, 56, 9, 1
Offset: 0
Comments
Examples
Array A(n, k) starts: [0] 1, 0, 0, 0, 0, 0, 0, 0, 0, ... A000007 [1] 1, 1, 0, 0, 0, 0, 0, 0, 0, ... A019590 [2] 1, 2, 2, 6, 12, 30, 54, 126, 240, ... A027375 [3] 1, 3, 6, 24, 72, 240, 696, 2184, 6480, ... A054718 [4] 1, 4, 12, 60, 240, 1020, 4020, 16380, 65280, ... A054719 [5] 1, 5, 20, 120, 600, 3120, 15480, 78120, 390000, ... A054720 [6] 1, 6, 30, 210, 1260, 7770, 46410, 279930, 1678320, ... A054721 [7] 1, 7, 42, 336, 2352, 16800, 117264, 823536, 5762400, ... A218124 [8] 1, 8, 56, 504, 4032, 32760, 261576, 2097144, 16773120, ... A218125 A000012|A002378| A047928 | A218130 | A218131 A001477,A007531, A061167, A133499, (diagonal A252764) . Triangle T(n, k) starts: [0] 1; [1] 0, 1; [2] 0, 1, 1; [3] 0, 0, 2, 1; [4] 0, 0, 2, 3, 1; [5] 0, 0, 6, 6, 4, 1; [6] 0, 0, 12, 24, 12, 5, 1; [7] 0, 0, 30, 72, 60, 20, 6, 1; [8] 0, 0, 54, 240, 240, 120, 30, 7, 1;
Links
- E. N. Gilbert and J. Riordan, Symmetry types of periodic sequences, Illinois J. Math., 5 (1961), 657-665.
Crossrefs
Programs
-
Maple
A363916 := (n, k) -> local d; add(A363914(k, d) * n^d, d = 0 ..k): for n from 0 to 9 do seq(A363916(n, k), k = 0..8) od;
-
SageMath
def A363916(n, k): return sum(A363914(k, d) * n^d for d in range(k + 1)) for n in range(9): print([A363916(n, k) for k in srange(9)]) def T(n, k): return A363916(k, n - k)
A378203 Number of palindromic n-ary words of length n that include the last letter of their respective alphabet.
1, 1, 1, 5, 7, 61, 91, 1105, 1695, 26281, 40951, 771561, 1214423, 26916709, 42664987, 1087101569, 1732076671, 49868399761, 79771413871, 2560599031177, 4108933742199, 145477500542221, 234040800869107, 9059621800971105, 14605723004036255, 613627780919407801
Offset: 0
Examples
a(0) = 1: (). a(1) = 1: (a). a(2) = 1: (b,b). a(3) = 5: (a,c,a), (b,c,b), (c,a,c), (c,b,c), (c,c,c).
Programs
-
Maple
a:= n-> (h-> n^h-`if`(n=0, 0, (n-1)^h))(ceil(n/2)): seq(a(n), n=0..25); # Alois P. Heinz, Nov 21 2024
-
Mathematica
h[n_] := Ceiling[n/2];a[n_] := n^h[n] - (n - 1)^h[n];Join[{1},Table[a[n],{n,25}]] (* James C. McMahon, Nov 21 2024 *)
-
PARI
h(n) = {ceil(n/2)} a(n) = {n^h(n)-(n-1)^h(n)}
-
Python
def A378203(n): return n**(m:=n+1>>1)-(n-1)**m if n else 1 # Chai Wah Wu, Nov 21 2024
Formula
a(n) = n^h(n) - (n-1)^h(n) for n > 0, where h(n) = ceiling(n/2).
a(n) = A047969(n-1,h(n)-1) for n > 0.
Comments