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.

A348490 Positive numbers whose square starts and ends with exactly one 6.

This page as a plain text file.
%I A348490 #25 Sep 08 2022 08:46:26
%S A348490 26,246,254,256,264,776,784,786,794,796,804,806,824,826,834,836,2454,
%T A348490 2456,2464,2466,2474,2476,2484,2486,2494,2496,2504,2506,2514,2516,
%U A348490 2524,2526,2534,2536,2544,2546,2554,2556,2564,2566,2594,2596,2604,2606,2614,2616,2624,2626,2634,2636,2644,7746
%N A348490 Positive numbers whose square starts and ends with exactly one 6.
%C A348490 When a square ends with 6, it ends with only one 6.
%C A348490 From _Marius A. Burtea_, Oct 30 2021 : (Start)
%C A348490 The sequence is infinite because the numbers 806, 8006, 80006, ..., 8*10^k + 6, k >= 2, are terms with squares 649636, 64096036, 6400960036, 640009600036, ..., 64*10^(2*k) + 96*10^k + 36, k >= 2.
%C A348490 Numbers 796, 7996, 79996, 799996, 7999996, 79999996, ..., 10^k*8 - 4, k >= 2, are terms and have no digits 0, because their squares are 633616, 63936016, 6399360016, 639993600016, 63999936000016, 6399999360000016, ....
%C A348490 Also 794, 7994, 79994, 799994, ..., (8*10^k - 6), k >= 2, are terms and have no digits 0, because their squares are 630436, 63904036, 6399040036, 639990400036, 63999904000036, 6399999040000036, ... (End)
%e A348490 26^2 = 676, hence 26 is a term.
%e A348490 814^2 = 662596, hence 814 is not a term.
%t A348490 Select[Range[10, 7750], (d = IntegerDigits[#^2])[[1]] == d[[-1]] == 6 && d[[2]] != 6 &] (* _Amiram Eldar_, Oct 30 2021 *)
%o A348490 (Python)
%o A348490 from itertools import count, takewhile
%o A348490 def ok(n):
%o A348490   s = str(n*n); return len(s.rstrip("6")) == len(s.lstrip("6")) == len(s)-1
%o A348490 def aupto(N):
%o A348490   r = takewhile(lambda x: x<=N, (10*i+d for i in count(0) for d in [4, 6]))
%o A348490   return [k for k in r if ok(k)]
%o A348490 print(aupto(2644)) # _Michael S. Branicky_, Oct 29 2021
%o A348490 (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
%o A348490 (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
%Y A348490 Cf. A045789, A045860, A273373 (squares ending with 6).
%Y A348490 Similar to: A348487 (k=1), A348488 (k=4), A348489 (k=5), this sequence (k=6), A348491 (k=9).
%Y A348490 Subsequence of A305719.
%K A348490 nonn,base
%O A348490 1,1
%A A348490 _Bernard Schott_, Oct 29 2021