OFFSET
1,1
COMMENTS
When a square ends with 6, it ends with only one 6.
From Marius A. Burtea, Oct 30 2021 : (Start)
The sequence is infinite because the numbers 806, 8006, 80006, ..., 8*10^k + 6, k >= 2, are terms with squares 649636, 64096036, 6400960036, 640009600036, ..., 64*10^(2*k) + 96*10^k + 36, k >= 2.
Numbers 796, 7996, 79996, 799996, 7999996, 79999996, ..., 10^k*8 - 4, k >= 2, are terms and have no digits 0, because their squares are 633616, 63936016, 6399360016, 639993600016, 63999936000016, 6399999360000016, ....
Also 794, 7994, 79994, 799994, ..., (8*10^k - 6), k >= 2, are terms and have no digits 0, because their squares are 630436, 63904036, 6399040036, 639990400036, 63999904000036, 6399999040000036, ... (End)
EXAMPLE
26^2 = 676, hence 26 is a term.
814^2 = 662596, hence 814 is not a term.
MATHEMATICA
Select[Range[10, 7750], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 6 && d[[2]] != 6 &] (* Amiram Eldar, Oct 30 2021 *)
PROG
(Python)
from itertools import count, takewhile
def ok(n):
s = str(n*n); return len(s.rstrip("6")) == len(s.lstrip("6")) == len(s)-1
def aupto(N):
r = takewhile(lambda x: x<=N, (10*i+d for i in count(0) for d in [4, 6]))
return [k for k in r if ok(k)]
print(aupto(2644)) # Michael S. Branicky, Oct 29 2021
(PARI) isok(k) = my(d=digits(sqr(k))); (d[1]==6) && (d[#d]==6) && if (#d>2, (d[2]!=6) && (d[#d-1]!=6), 1); \\ Michel Marcus, Oct 30 2021
(Magma) [n:n in [4..7500]|Intseq(n*n)[1] eq 6 and Intseq(n*n)[#Intseq(n*n)] eq 6 and Intseq(n*n)[-1+#Intseq(n*n)] ne 6 ]; // Marius A. Burtea, Oct 30 2021
CROSSREFS
Subsequence of A305719.
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Oct 29 2021
STATUS
approved