OFFSET
1,1
COMMENTS
The three ending digits of a(n)^2 are 000 or 444.
n is in the sequence iff either n == 0 mod 100 or n == (+/-)38 mod 500. - Robert Israel, Jul 03 2014
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,0,0,0,1,-1).
FORMULA
a(n) = a(n-7) + 500 for n > 7. - Zak Seidov and Bruno Berselli, Feb 23 2011
G.f.: 2*x*(19*x^2 +12*x +19)*(x^4 +x^3 +x^2 +x +1) / ((x -1)^2*(x^6 +x^5 +x^4 +x^3 +x^2 +x +1)). - Colin Barker, Jul 03 2014
EXAMPLE
462 is in the sequence because 462^2 = 213444.
MAPLE
with(numtheory):T:=array(1..10):for p from 1 to 10000 do:n:=p^2:l:=length(n):n0:=n:for
m from 1 to l do:q:=n0:u:=irem(q, 10):v:=iquo(q, 10):n0:=v :T[m]:=u:od:if T[1]=T[2]
and T[1]=T[3] then printf(`%d, `, p):else fi:od:
# second Maple program:
a:= proc(n) local m, r;
r:= 1+ irem(n-1, 7, 'm');
[38, 100, 200, 300, 400, 462, 500][r] +500*m
end:
seq(a(n), n=1..100); # Alois P. Heinz, Feb 24 2011
MATHEMATICA
Select[Range[11, 10000], Mod[PowerMod[#, 2, 1000], 111]==0&] (* Zak Seidov, Feb 23 2011 *)
PROG
(PARI) for(n=11, 10000, if((n^2%1000)%111==0, print1(n", "))) \\ Zak Seidov, Feb 23 2011
(PARI) Vec(2*x*(19*x^2 +12*x +19)*(x^4 +x^3 +x^2 +x +1)/((x -1)^2*(x^6 +x^5 +x^4 +x^3 +x^2 +x +1)) + O(x^100)) \\ Colin Barker, Jul 03 2014
(Python)
def ok(n): s = str(n*n); return len(s) > 2 and s[-1] == s[-2] == s[-3]
print(list(filter(ok, range(3463)))) # Michael S. Branicky, Jul 29 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Michel Lagneau, Feb 21 2011
STATUS
approved