|
|
A039306
|
|
Number of distinct quadratic residues mod 9^n.
|
|
2
|
|
|
1, 4, 31, 274, 2461, 22144, 199291, 1793614, 16142521, 145282684, 1307544151, 11767897354, 105911076181, 953199685624, 8578797170611, 77209174535494, 694882570819441, 6253943137374964, 56285488236374671, 506569394127372034
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,2
|
|
COMMENTS
|
Number of distinct n-digit suffixes of base 9 squares.
Construct the word y_n as follows: y_0 = a; y_{n+1} is three concatenated copies of y_n, except that the middle copy is written with letters not used in y_n. For example:
y_0 = a;
y_1 = aba;
y_2 = abacdcaba;
y_3 = abacdcabaefeghgefeabacdcaba.
a(n) is the number of nonempty subwords of y_n that occur as a subword exactly once.
Let s(n, k) be the number of subwords of y_n that occur exactly 2^k times. One can show that s(n, 0) = a(n) using s(n+1, k+1) = s(n, k) + s(n, k+1), binomial(3^n+1, 2) = Sum_{k=0..n) s(n, k)*2^k, and the formulas for a(n) below.
(End)
|
|
LINKS
|
|
|
FORMULA
|
a(n) = floor((9^n+3)*3/8).
G.f.: (1-6*x)/((1-x)*(1-9*x)). - _Colin Barker, Mar 14 2012
|
|
EXAMPLE
|
The squares of the numbers 0..8 are [0, 1, 4, 9, 16, 25, 36, 49, 64]. Modulo 9, these are [0, 1, 4, 0, 7, 7, 0, 4, 1]. Thus there are a(1) = 4 distinct quadratic residues module 9^1 = 9: 0, 1, 4, and 7.
There are a(2) = 31 subwords of y_2 = abacdcaba which occur in y_2 exactly once: [abac, abacd, abacdc, abacdca, abacdcab, abacdcaba, bac, bacd, bacdc, bacdca, bacdcab, bacdcaba, ac, acd, acdc, acdca, acdcab, acdcaba, cd, cdc, cdca, cdcab, cdcaba, d, dc, dca, dcab, dcaba, ca, cab, caba].
(End)
|
|
MATHEMATICA
|
CoefficientList[Series[(1-6*x)/((1-x)*(1-9*x)), {x, 0, 30}], x] (* Vincenzo Librandi, Apr 22 2012 *)
|
|
PROG
|
(Magma) I:=[1, 4, 31]; [n le 3 select I[n] else 9*Self(n-1)+Self(n-2)-9*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Apr 22 2012
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|