cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A258103 #50 Oct 05 2024 21:05:58
%S A258103 0,0,1,0,1,3,4,26,87,47,87,0,547,1303,3402,0,24192,187562
%N A258103 Number of pandigital squares (containing each digit exactly once) in base n.
%C A258103 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 A258103 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 A258103 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 A258103 A. J. T. Partridge, <a href="http://chalkdustmagazine.com/blog/pandigital-square-numbers/">Why there are no pandigital squares in base 13</a>
%H A258103 Chai Wah Wu, <a href="https://accidentaldesultorycogitations.blogspot.com/2024/02/square-pandigital-numbers.html">Square pandigital numbers</a>
%H A258103 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 A258103 For n=4 there is one pandigital square, 3201_4 = 225 = 15^2.
%e A258103 For n=6 there is one pandigital square, 452013_6 = 38025 = 195^2.
%e A258103 For n=10 there are 87 pandigital squares (A036745).
%e A258103 There are no pandigital squares in bases 2, 3, 5 or 13.
%e A258103 Hexadecimal has 3402 pandigital squares, the largest is FED5B39A42706C81.
%o A258103 (Python)
%o A258103 from gmpy2 import isqrt, mpz, digits
%o A258103 def A258103(n): # requires 2 <= n <= 62
%o A258103     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 A258103     m = isqrt(sq)
%o A258103     sq = m*m
%o A258103     m = 2*m+1
%o A258103     while sq <= sm:
%o A258103         if len(set(digits(sq, n))) == n:
%o A258103             c += 1
%o A258103         sq += m
%o A258103         m += 2
%o A258103     return c # _Chai Wah Wu_, May 20 2015
%o A258103 (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 A258103 Cf. A036745, A054038, A071519.
%K A258103 base,nonn,more
%O A258103 2,6
%A A258103 _Adam J.T. Partridge_, May 20 2015
%E A258103 a(17)-a(19) from _Giovanni Resta_, May 20 2015