OFFSET
1,10
COMMENTS
Pandigital squares are perfect squares containing each digit from 0 to 9 at least once.
EXAMPLE
a(n) = 0 for n < 10, since a number must have at least ten digits to contain all digits from 0 to 9 at least once.
a(10) = 87 since there are 87 ten-digit pandigital squares from 1026753849 to 9814072356 (cf. A036745) containing each digit from 0 to 9, here exactly once.
MAPLE
a:=proc(n::posint) local p, k, K: if n<10 then p:=0; else p:=0: for k from ceil(sqrt(10^(n-1))) to floor(sqrt(10^n)) do K:=convert(k^2, base, 10); if nops({op(K)})=10 then p:=p+1: fi: od: fi: return p; end:
PROG
(Python)
from math import isqrt
def c(n): return len(set(str(n))) == 10
def a(n):
lb = isqrt(10**(n-1)) if n&1 else isqrt(10**(n-1)) + 1
return sum(1 for k in range(lb, isqrt(10**n-1)+1) if c(k*k))
print([a(n) for n in range(1, 14)]) # Michael S. Branicky, Dec 27 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Martin Renner, Dec 27 2022
EXTENSIONS
a(19)-a(21) from Michael S. Branicky, Dec 27 2022
STATUS
approved