# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a348487 Showing 1-1 of 1 %I A348487 #30 Sep 08 2022 08:46:26 %S A348487 1,11,39,41,101,111,119,121,129,131,139,141,319,321,329,331,349,351, %T A348487 359,361,369,371,379,381,389,391,399,401,409,411,419,421,429,431,439, %U A348487 441,1001,1009,1011,1019,1021,1029,1031,1039,1041,1099,1101,1109,1111,1119,1121,1129,1131,1139 %N A348487 Positive numbers whose square starts and ends with exactly one 1. %C A348487 When a square ends with 1, this square ends with exactly one 1. %C A348487 Sequences A000533 and A253213 show that there are an infinity of terms. The square of their terms, for n >= 3, starts and ends with exactly one 1. Also, the numbers 119, 1119, 11119, ..., ((10^k + 71) / 9)^2, (k >= 3) are terms. The squares ((10^k + 71) / 9)^2, have the last digit 1 and because 12*10^(2*k - 3) < ((10^k + 71) / 9)^2 <13*10^(2*k - 3), for k >= 3, the squares ((10^k + 71) / 9)^2, k >= 4, start with 12. - _Marius A. Burtea_, Oct 21 2021 %e A348487 39 is a term since 39^2 = 1521. %e A348487 109 is not a term since 109^2 = 11881. %e A348487 119 is a term since 119^2 = 14161. %t A348487 Join[{1}, Select[Range[11, 1200], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 1 && d[[2]] != 1 &]] (* _Amiram Eldar_, Oct 21 2021 *) %o A348487 (Python) %o A348487 from itertools import count, takewhile %o A348487 def ok(n): %o A348487 s = str(n*n); return len(s.rstrip("1")) == len(s.lstrip("1")) == len(s)-1 %o A348487 def aupto(N): %o A348487 r = takewhile(lambda x: x<=N, (10*i+d for i in count(0) for d in [1, 9])) %o A348487 return [k for k in r if ok(k)] %o A348487 print(aupto(1140)) # _Michael S. Branicky_, Oct 21 2021 %o A348487 (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 %o A348487 (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 %Y A348487 Cf. A045855, A090771, A253213, A273372 (squares ending with 1), A017281, A017377. %Y A348487 Cf. A000533, A253213 for n >= 2 (subsequences). %Y A348487 Subsequence of A305719. %K A348487 nonn,base %O A348487 1,2 %A A348487 _Bernard Schott_, Oct 21 2021 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE