login
A039304
Number of distinct quadratic residues mod 7^n.
4
1, 4, 22, 151, 1051, 7354, 51472, 360301, 2522101, 17654704, 123582922, 865080451, 6055563151, 42388942054, 296722594372, 2077058160601, 14539407124201, 101775849869404, 712430949085822, 4987016643600751, 34909116505205251
OFFSET
0,2
COMMENTS
Number of distinct n-digit suffixes of base 7 squares.
FORMULA
a(n) = floor( (7^n + 3)*7/16 ).
G.f.: (1 - 3*x - 7*x^2)/((1-x)*(1+x)*(1-7*x)). - Colin Barker, Mar 08 2012
a(n) = 7*a(n-1) + a(n-2) - 7*a(n-3). - Vincenzo Librandi, Apr 21 2012
a(n) = A000224(7^n). - R. J. Mathar, Sep 28 2017
MAPLE
A039304 := proc(n)
floor((7^n+3)*7/16) ;
end proc:
seq(A039304(n), n=0..10) ; # R. J. Mathar, Sep 28 2017
MATHEMATICA
CoefficientList[Series[(1-3*x-7*x^2)/((1-x)*(1+x)*(1-7*x)), {x, 0, 40}], x] (* Vincenzo Librandi, Apr 21 2012 *)
LinearRecurrence[{7, 1, -7}, {1, 4, 22}, 30] (* Harvey P. Dale, Aug 03 2016 *)
PROG
(Magma) [Floor((7^n+3)*7/16): n in [0..25]]; // Vincenzo Librandi, May 14 2011
(Magma) I:=[1, 4, 22]; [n le 3 select I[n] else 7*Self(n-1)+Self(n-2)-7*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Apr 21 2012
CROSSREFS
Cf. A000224, A000420 (7^n).
Sequence in context: A228883 A307439 A189845 * A349022 A267219 A152404
KEYWORD
nonn,easy
STATUS
approved