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.

A385300 Integers k containing only odd digits, except the last digit, such that k^2 is composed of only even digits.

Original entry on oeis.org

2, 8, 78, 92, 932, 7798, 51192, 939398, 5157798, 7797578, 7797978, 9393978, 15119592, 15773398, 53179378, 53559332, 77979998, 79175932, 155139378, 157759592, 517751738, 535393932, 917933998, 939597798, 1511979592, 5157759592, 7771757978, 7775735378, 9393959798
Offset: 1

Views

Author

Gonzalo Martínez, Jun 24 2025

Keywords

Comments

Although the terms in this list contain only odd digits, except for the units digit, their squares have only even digits.
The terms of the list are even numbers ending only in 2 or in 8. Proof: if n ends in 0, 4 or 6, since the penultimate digit of n is odd, then the last 2 digits of n can be: 10, 14, 16, 30, 34, 36, 50, 54, 56, 70, 74, 76, 90, 94 and 96. If n ends in 10, 30, 50, 70 or 90, then the antepenultimate digit of n^2 is odd, while in the other cases the penultimate digit of n^2 is odd.
a(n) == 32, 38, 78, 92, 98 (mod 100), for n > 3.
a(n) == 192, 332, 338, 378, 398, 578, 592, 738, 798, 932, 978, 992, 998 (mod 1000), for n > 4. - Chai Wah Wu, Jun 25 2025

Examples

			7798 is a term, since only the last digit is even and 7798^2 = 60808804, whose digits are all even.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[10^7],NoneTrue[Take[IntegerDigits[#],IntegerLength[#]-1],EvenQ]&&AllTrue[IntegerDigits[#^2],EvenQ]&] (* James C. McMahon, Jun 28 2025 *)
  • PARI
    odd(n) = {my(k=1); while(n>5^k, n-=5^k; k++); fromdigits([2*d+1 | d<-digits(5^k+n-1, 5)]) - 3*10^k}; \\ A014261
    lista(nn) = my(list=List()); forstep (e=2, 8, 2, if (#select(x->(x%2), digits(e^2)) == 0, listput(list, e));); for (n=1, nn, my(o=odd(n)); forstep (e=0, 8, 2, my(oe = 10*o+e); if (#select(x->(x%2), digits(oe^2)) == 0, listput(list, oe)););); Vec(list); \\ Michel Marcus, Jun 25 2025
    
  • Python
    from itertools import count, product, islice
    def A385300_gen(): # generator of terms
        for l in count(1):
            for d in product('13579',repeat=l):
                m = int(''.join(d))-1
                if m>0 and set(str(m**2))<={'0','2','4','6','8'}:
                    yield m
    A385300_list = list(islice(A385300_gen(),29)) # Chai Wah Wu, Jun 25 2025