login
Numbers n such that n^2 and n have same last 2 digits.
2

%I #15 Sep 08 2022 08:44:36

%S 0,1,25,76,100,101,125,176,200,201,225,276,300,301,325,376,400,401,

%T 425,476,500,501,525,576,600,601,625,676,700,701,725,776,800,801,825,

%U 876,900,901,925,976,1000,1001,1025,1076,1100,1101,1125,1176,1200,1201

%N Numbers n such that n^2 and n have same last 2 digits.

%D L. E. Dickson, History of the Theory of Numbers. Carnegie Institute Public. 256, Washington, DC, Vol. 1, 1919; Vol. 2, 1920; Vol. 3, 1923, see vol. 1, p. 459.

%H G. C. Greubel, <a href="/A008852/b008852.txt">Table of n, a(n) for n = 1..1000</a>

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

%F a(4n)=100*n, a(4n+1)=100*n+1, a(4n+2)=100*n+25, a(4n+3)=100*n+76. - _Franklin T. Adams-Watters_, Mar 13 2006

%F From _G. C. Greubel_, Sep 13 2019: (Start)

%F a(n) = a(n-1) + a(n-4) - a(n-5).

%F G.f.: x*(1 +24*x +51*x^2 +24*x^3)/((1-x)*(1-x^4)). (End)

%p for n to 2000 do if n^2 - n mod 100 = 0 then print(n); fi; od;

%t Select[Range[1200], Mod[ #, 100] == Mod[ #^2, 100] &] (* _Stefan Steinerberger_, Apr 15 2006 *)

%t LinearRecurrence[{1,0,0,1,-1}, {0,1,25,76,100}, 60] (* _G. C. Greubel_, Sep 13 2019 *)

%o (PARI) my(x='x+O('x^60)); concat([0], Vec(x*(1 +24*x +51*x^2 +24*x^3)/((1-x)*(1-x^4)))) \\ _G. C. Greubel_, Sep 13 2019

%o (Magma) R<x>:=PowerSeriesRing(Integers(), 60); [0] cat Coefficients(R!( x*(1 +24*x +51*x^2 +24*x^3)/((1-x)*(1-x^4)) )); // _G. C. Greubel_, Sep 13 2019

%o (Sage) [n for n in (0..1250) if mod(n,100)==mod(n^2,100)] # _G. C. Greubel_, Sep 13 2019

%o (GAP) a:=[0,1,25,76,100];; for n in [6..60] do a[n]:=a[n-1]+a[n-4]-a[n-5]; od; a; # _G. C. Greubel_, Sep 13 2019

%K nonn,easy,base

%O 1,3

%A _N. J. A. Sloane_