OFFSET
0,2
COMMENTS
Number of distinct n-digit suffixes of base 9 squares.
From Danny Rorabaugh, Dec 15 2015: (Start)
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
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (10,-9).
FORMULA
a(n) = floor((9^n+3)*3/8).
G.f.: (1-6*x)/((1-x)*(1-9*x)). - _Colin Barker, Mar 14 2012
a(n) = 9*a(n-1) +a(n-2) -9*a(n-3). - Vincenzo Librandi, Apr 22 2012
a(n) = (5+3^(2n+1))/8 = a(n-1) + 3^(2n-1). - Danny Rorabaugh, Dec 15 2015
EXAMPLE
From Danny Rorabaugh, Dec 15 2015: (Start)
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