

A258103


Number of pandigital squares (containing each digit exactly once) in base n.


3



0, 0, 1, 0, 1, 3, 4, 26, 87, 47, 87, 0, 547, 1303, 3402, 0, 24192, 187562
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

2,6


COMMENTS

For n = 18, the smallest and largest pandigital squares are 2200667320658951859841 and 39207739576969100808801. For n = 19, they are 104753558229986901966129 and 1972312183619434816475625. For n = 20, they are 5272187100814113874556176 and 104566626183621314286288961.  Chai Wah Wu, May 20 2015
When n is even, (n1) is a factor of the pandigital squares. When n is odd, (n1)/2 is a factor with the remaining factors being odd. Therefore, when n is odd and (n1)/2 has an odd number of 2s as prime factors there are no pandigital squares in base n (e.g. 5, 13, 17 and 21).  Adam J.T. Partridge, May 21 2015


LINKS



EXAMPLE

For n=4 there is one pandigital square, 3201_4 = 225 = 15^2.
For n=6 there is one pandigital square, 452013_6 = 38025 = 195^2.
For n=10 there are 87 pandigital squares (A036745).
There are no pandigital squares in bases 2, 3, 5 or 13.
Hexadecimal has 3402 pandigital squares, the largest is FED5B39A42706C81.


PROG

(Python)
from gmpy2 import isqrt, mpz, digits
def A258103(n): # requires 2 <= n <= 62
....c, sm, sq = 0, mpz(''.join([digits(i, n) for i in range(n1, 1, 1)]), n), mpz(''.join(['1', '0']+[digits(i, n) for i in range(2, n)]), n)
....m = isqrt(sq)
....sq = m*m
....m = 2*m+1
....while sq <= sm:
........if len(set(digits(sq, n))) == n:
............c += 1
........sq += m
........m += 2


CROSSREFS



KEYWORD

base,nonn,more


AUTHOR



EXTENSIONS



STATUS

approved



