login
Number of distinct quadratic residues mod 7^n.
4

%I #28 Sep 08 2022 08:44:53

%S 1,4,22,151,1051,7354,51472,360301,2522101,17654704,123582922,

%T 865080451,6055563151,42388942054,296722594372,2077058160601,

%U 14539407124201,101775849869404,712430949085822,4987016643600751,34909116505205251

%N Number of distinct quadratic residues mod 7^n.

%C Number of distinct n-digit suffixes of base 7 squares.

%H Vincenzo Librandi, <a href="/A039304/b039304.txt">Table of n, a(n) for n = 0..200</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (7,1,-7).

%F a(n) = floor( (7^n + 3)*7/16 ).

%F G.f.: (1 - 3*x - 7*x^2)/((1-x)*(1+x)*(1-7*x)). - _Colin Barker_, Mar 08 2012

%F a(n) = 7*a(n-1) + a(n-2) - 7*a(n-3). - _Vincenzo Librandi_, Apr 21 2012

%F a(n) = A000224(7^n). - _R. J. Mathar_, Sep 28 2017

%p A039304 := proc(n)

%p floor((7^n+3)*7/16) ;

%p end proc:

%p seq(A039304(n),n=0..10) ; # _R. J. Mathar_, Sep 28 2017

%t CoefficientList[Series[(1-3*x-7*x^2)/((1-x)*(1+x)*(1-7*x)),{x,0,40}],x] (* _Vincenzo Librandi_, Apr 21 2012 *)

%t LinearRecurrence[{7,1,-7},{1,4,22},30] (* _Harvey P. Dale_, Aug 03 2016 *)

%o (Magma) [Floor((7^n+3)*7/16): n in [0..25]]; // _Vincenzo Librandi_, May 14 2011

%o (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

%Y Cf. A000224, A000420 (7^n).

%K nonn,easy

%O 0,2

%A _David W. Wilson_