A348489 Positive numbers whose square starts and ends with exactly one 5.
75, 225, 715, 725, 735, 755, 765, 2245, 2255, 2265, 2275, 2285, 2295, 2305, 2315, 2325, 2335, 2345, 2375, 2385, 2395, 2405, 2415, 2425, 2435, 2445, 7075, 7085, 7095, 7105, 7115, 7125, 7135, 7145, 7155, 7165, 7175, 7185, 7195, 7205, 7215, 7225, 7235, 7245
Offset: 1
Examples
75^2 = 5625, hence 75 is a term. 235^2 = 55225, hence 235 is not a term.
Crossrefs
Programs
-
Magma
[n:n in [4..7500]|Intseq(n*n)[1] eq 5 and Intseq(n*n)[#Intseq(n*n)] eq 5 and Intseq(n*n)[-1+#Intseq(n*n)] ne 5 ]; // Marius A. Burtea, Oct 25 2021
-
Mathematica
Select[5 * Range[2, 1500], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 5 && d[[2]] != 5 &] (* Amiram Eldar, Oct 25 2021 *)
-
PARI
isok(k) = my(d=digits(sqr(k))); (d[1]==5) && (d[#d]==5) && if (#d>2, (d[2]!=5) && (d[#d-1]!=5), 1); \\ Michel Marcus, Oct 25 2021
-
Python
from itertools import count, takewhile def ok(n): s = str(n*n); return len(s.rstrip("5")) == len(s.lstrip("5")) == len(s)-1 def aupto(N): r = takewhile(lambda x: x<=N, (10*i+5 for i in count(0))) return [k for k in r if ok(k)] print(aupto(7245)) # Michael S. Branicky, Oct 26 2021
Comments