login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A258103 Number of pandigital squares (containing each digit exactly once) in base n. 7

%I #47 Apr 04 2024 10:13:59

%S 0,0,1,0,1,3,4,26,87,47,87,0,547,1303,3402,0,24192,187562

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

%C 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

%C When n is even, (n-1) is a factor of the pandigital squares. When n is odd, (n-1)/2 is a factor with the remaining factors being odd. Therefore, when n is odd and (n-1)/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

%C If n is odd and (n-1)/2 has an odd 2-adic valuation, then there are no squares in base n using all the digits from 1 to n-1 once, or all the digits from 0 to n-2 once or all the digits from 1 to n-2 once. This can be proved using the same argument as in the linked blogposts. - _Chai Wah Wu_, Feb 25 2024

%H A. J. T. Partridge, <a href="http://chalkdustmagazine.com/blog/pandigital-square-numbers/">Why there are no pandigital squares in base 13</a>

%H Chai Wah Wu, <a href="https://accidentaldesultorycogitations.blogspot.com/2024/02/square-pandigital-numbers.html">Square pandigital numbers</a>

%H Chai Wah Wu, <a href="https://arxiv.org/abs/2403.20304">Pandigital and penholodigital numbers</a>, arXiv:2403.20304 [math.GM], 2024. See p. 2.

%e For n=4 there is one pandigital square, 3201_4 = 225 = 15^2.

%e For n=6 there is one pandigital square, 452013_6 = 38025 = 195^2.

%e For n=10 there are 87 pandigital squares (A036745).

%e There are no pandigital squares in bases 2, 3, 5 or 13.

%e Hexadecimal has 3402 pandigital squares, the largest is FED5B39A42706C81.

%o (Python)

%o from gmpy2 import isqrt, mpz, digits

%o def A258103(n): # requires 2 <= n <= 62

%o ....c, sm, sq = 0, mpz(''.join([digits(i,n) for i in range(n-1,-1,-1)]),n), mpz(''.join(['1','0']+[digits(i,n) for i in range(2,n)]),n)

%o ....m = isqrt(sq)

%o ....sq = m*m

%o ....m = 2*m+1

%o ....while sq <= sm:

%o ........if len(set(digits(sq,n))) == n:

%o ............c += 1

%o ........sq += m

%o ........m += 2

%o ....return c # _Chai Wah Wu_, May 20 2015

%o (PARI) a(n) = if(n%2==1 && valuation(n-1,2)%2==0, 0, my(lim=sqrtint(n^n - (n^n-n)/(n-1)^2), count=0); for(m=sqrtint((n^n-n)/(n-1)^2 + n^(n-2)*(n-1) - 1), lim, if(#Set(digits(m^2,n))==n, count++)); count) \\ _Jianing Song_, Feb 23 2024. Note that the searching range for m is [sqrt(A049363(n)), sqrt(A062813(n))]

%Y Cf. A036745, A054038, A071519.

%K base,nonn,more

%O 2,6

%A _Adam J.T. Partridge_, May 20 2015

%E a(17)-a(19) from _Giovanni Resta_, May 20 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 19:56 EDT 2024. Contains 371963 sequences. (Running on oeis4.)