OFFSET
1,2
COMMENTS
Of course, the one odd digit in the square is always the last digit.
The sequence is infinite because it contains the family of numbers 5, 53, 533, 5333, ....... with squares 25, 2809, 284089, 28440889, 2844408889. .... and respectively 535, 5335, 53335, ... with squares 286225, 28462225, 2844622225, 284446222225, ... - Marius A. Burtea, May 21 2021
EXAMPLE
53179 is a term: all its digits are odd, and 53179^2 = 2828006041 has only one odd digit.
15113133375599 is a term: all its digits are odd, and 15113133375599^2 = 228406800428644424408608801 has only one odd digit.
MATHEMATICA
Select[Range[160000], AllTrue[IntegerDigits[#], OddQ] && AllTrue[Most @ IntegerDigits[#^2], EvenQ] &] (* Amiram Eldar, May 20 2021 *)
PROG
(Python)
def ok(n):
r, s = str(n), str(n*n)
return all(d in "13579" for d in r) and all(d in "02468" for d in s[:-1])
print(list(filter(ok, range(1, 155192, 2)))) # Michael S. Branicky, May 20 2021
(Python)
from itertools import product
A343727_list = [n for n in (int(''.join(d)) for l in range(1, 6) for d in product('13579', repeat=l)) if set(str(n**2)[:-1]) <= set('02468')] # Chai Wah Wu, May 21 2021
(Magma) [n:n in [1..160000 by 2]|Set(Intseq(n)) subset {1, 3, 5, 7, 9} and Set(Intseq(n*n div 10)) subset {0, 2, 4, 6, 8}]; // Marius A. Burtea, May 21 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Jon E. Schoenfield, May 20 2021
STATUS
approved