A348487 Positive numbers whose square starts and ends with exactly one 1.
1, 11, 39, 41, 101, 111, 119, 121, 129, 131, 139, 141, 319, 321, 329, 331, 349, 351, 359, 361, 369, 371, 379, 381, 389, 391, 399, 401, 409, 411, 419, 421, 429, 431, 439, 441, 1001, 1009, 1011, 1019, 1021, 1029, 1031, 1039, 1041, 1099, 1101, 1109, 1111, 1119, 1121, 1129, 1131, 1139
Offset: 1
Examples
39 is a term since 39^2 = 1521. 109 is not a term since 109^2 = 11881. 119 is a term since 119^2 = 14161.
Crossrefs
Programs
-
Magma
[1] cat [n:n in [2..1200]|Intseq(n*n)[1] eq 1 and Intseq(n*n)[#Intseq(n*n)] eq 1 and Intseq(n*n)[-1+#Intseq(n*n)] ne 1]; // Marius A. Burtea, Oct 21 2021
-
Mathematica
Join[{1}, Select[Range[11, 1200], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 1 && d[[2]] != 1 &]] (* Amiram Eldar, Oct 21 2021 *)
-
PARI
isok(k) = my(d=digits(sqr(k))); (d[1]==1) && (d[#d]==1) && if (#d>2, (d[2]!=1) && (d[#d-1]!=1), 1); \\ Michel Marcus, Oct 21 2021
-
Python
from itertools import count, takewhile def ok(n): s = str(n*n); return len(s.rstrip("1")) == len(s.lstrip("1")) == len(s)-1 def aupto(N): r = takewhile(lambda x: x<=N, (10*i+d for i in count(0) for d in [1, 9])) return [k for k in r if ok(k)] print(aupto(1140)) # Michael S. Branicky, Oct 21 2021
Comments