This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A348488 #29 Sep 08 2022 08:46:26 %S A348488 2,22,68,202,208,218,222,642,648,652,658,672,678,682,692,698,702,2002, %T A348488 2008,2018,2022,2028,2032,2042,2048,2052,2058,2068,2072,2078,2082, %U A348488 2092,2122,2128,2132,2142,2148,2152,2158,2168,2172,2178,2182,2192,2198,2202,2208,2218,2222,2228 %N A348488 Positive numbers whose square starts and ends with exactly one 4. %C A348488 When a square ends with 4 (A273375), this square may end with precisely one 4, two 4's or three 4's (A328886). %C A348488 This sequence is infinite as each 2*(10^m + 1), m >= 1 or 2*(10^m + 4), m >= 2 is a term. %C A348488 Numbers 2, 22, 222, ..., 2*(10^k - 1) / 9, (k >= 1), as well as numbers 2228, 22228, ..., 2*(10^k + 52) / 9, (k >= 4) are terms and have no digits 0. - _Marius A. Burtea_, Oct 24 2021 %e A348488 22 is a term since 22^2 = 484. %e A348488 638 is not a term since 638^2 = 407044. %e A348488 668 is not a term since 668^2 = 446224. %t A348488 Join[{2}, Select[Range[10, 2000], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 4 && d[[-2]] != 4 && d[[2]] != 4 &]] (* _Amiram Eldar_, Oct 24 2021 *) %o A348488 (PARI) isok(k) = my(d=digits(sqr(k))); (d[1]==4) && (d[#d]==4) && if (#d>2, (d[2]!=4) && (d[#d-1]!=4), 1); \\ _Michel Marcus_, Oct 24 2021 %o A348488 (Magma) [2] cat [n:n in [4..2300]|Intseq(n*n)[1] eq 4 and Intseq(n*n)[#Intseq(n*n)] eq 4 and Intseq(n*n)[-1+#Intseq(n*n)] ne 4 and Intseq(n*n)[2] ne 4]; // _Marius A. Burtea_, Oct 24 2021 %o A348488 (Python) %o A348488 from itertools import count, takewhile %o A348488 def ok(n): %o A348488 s = str(n*n); return len(s.rstrip("4")) == len(s.lstrip("4")) == len(s)-1 %o A348488 def aupto(N): %o A348488 r = takewhile(lambda x: x<=N, (10*i+d for i in count(0) for d in [2, 8])) %o A348488 return [k for k in r if ok(k)] %o A348488 print(aupto(2228)) # _Michael S. Branicky_, Oct 24 2021 %Y A348488 Cf. A045858, A273375 (squares ending with 4), A017317, A328886 (squares ending with three 4). %Y A348488 Cf. A002276 \ {0} (a subsequence). %Y A348488 Subsequence of A305719. %Y A348488 Similar to: A348487 (k=1), this sequence (k=4), A348489 (k=5), A348490 (k=6). %K A348488 nonn,base %O A348488 1,1 %A A348488 _Bernard Schott_, Oct 24 2021