A348490 Positive numbers whose square starts and ends with exactly one 6.
26, 246, 254, 256, 264, 776, 784, 786, 794, 796, 804, 806, 824, 826, 834, 836, 2454, 2456, 2464, 2466, 2474, 2476, 2484, 2486, 2494, 2496, 2504, 2506, 2514, 2516, 2524, 2526, 2534, 2536, 2544, 2546, 2554, 2556, 2564, 2566, 2594, 2596, 2604, 2606, 2614, 2616, 2624, 2626, 2634, 2636, 2644, 7746
Offset: 1
Examples
26^2 = 676, hence 26 is a term. 814^2 = 662596, hence 814 is not a term.
Crossrefs
Programs
-
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
-
Mathematica
Select[Range[10, 7750], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 6 && d[[2]] != 6 &] (* Amiram Eldar, Oct 30 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
-
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
Comments