cp's OEIS Frontend

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.

A348489 Positive numbers whose square starts and ends with exactly one 5.

This page as a plain text file.
%I A348489 #36 Sep 08 2022 08:46:26
%S A348489 75,225,715,725,735,755,765,2245,2255,2265,2275,2285,2295,2305,2315,
%T A348489 2325,2335,2345,2375,2385,2395,2405,2415,2425,2435,2445,7075,7085,
%U A348489 7095,7105,7115,7125,7135,7145,7155,7165,7175,7185,7195,7205,7215,7225,7235,7245
%N A348489 Positive numbers whose square starts and ends with exactly one 5.
%C A348489 When a square ends with 5, it ends with 25.
%C A348489 From  _Marius A. Burtea_, Oct 25 2021: (Start)
%C A348489 Numbers 75, 765, 7665, 76665, ..., (23*10^k -5) / 3, k >= 1, are terms and have no digits 0, because their squares are 5625, 585225, 58752225, 5877522225, 587775222225, 58777752222225, ...
%C A348489 Also 75, 735, 7335, 73335, ..., (22*10^n+5) / 3, k >= 1, are terms and have no digits 0, because their squares are 5625, 540225, 53802225, 5378022225, 537780222225, 53777802222225, ... (End)
%e A348489 75^2 = 5625, hence 75 is a term.
%e A348489 235^2 = 55225, hence 235 is not a term.
%t A348489 Select[5 * Range[2, 1500], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 5 && d[[2]] != 5 &] (* _Amiram Eldar_, Oct 25 2021 *)
%o A348489 (PARI) isok(k) = my(d=digits(sqr(k))); (d[1]==5) && (d[#d]==5) && if (#d>2, (d[2]!=5) && (d[#d-1]!=5), 1); \\ _Michel Marcus_, Oct 25 2021
%o A348489 (Magma) [n:n in [4..7500]|Intseq(n*n)[1] eq 5 and Intseq(n*n)[#Intseq(n*n)] eq 5 and Intseq(n*n)[-1+#Intseq(n*n)] ne 5 ]; // _Marius A. Burtea_, Oct 25 2021
%o A348489 (Python)
%o A348489 from itertools import count, takewhile
%o A348489 def ok(n):
%o A348489   s = str(n*n); return len(s.rstrip("5")) == len(s.lstrip("5")) == len(s)-1
%o A348489 def aupto(N):
%o A348489   r = takewhile(lambda x: x<=N, (10*i+5 for i in count(0)))
%o A348489   return [k for k in r if ok(k)]
%o A348489 print(aupto(7245)) # _Michael S. Branicky_, Oct 26 2021
%Y A348489 Cf. A045859, A017330 (squares ending with 5).
%Y A348489 Similar to: A348487 (k=1), A348488 (k=4), this sequence (k=5), A348490 (k=6), A348491 (k=9).
%Y A348489 Subsequence of A305719.
%K A348489 nonn,base
%O A348489 1,1
%A A348489 _Bernard Schott_, Oct 25 2021