

A258103


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


1



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

Table of n, a(n) for n=2..19.
A. J. T. Partridge, Why there are no pandigital squares in base 13


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
....return c # Chai Wah Wu, May 20 2015


CROSSREFS

Cf. A036745, A054038, A071519.
Sequence in context: A055348 A004206 A151372 * A222112 A032832 A041021
Adjacent sequences: A258100 A258101 A258102 * A258104 A258105 A258106


KEYWORD

base,nonn,more


AUTHOR

Adam J.T. Partridge, May 20 2015


EXTENSIONS

a(17)a(19) from Giovanni Resta, May 20 2015


STATUS

approved



