A370950 Number of penholodigital squares (containing each nonzero digit exactly once) in base n.
1, 0, 0, 0, 2, 1, 1, 10, 30, 20, 23, 0, 160, 419, 740, 0, 5116, 47677
Offset: 2
Examples
For n=2 there is one penholodigital square, 1_2 = 1 = 1^2. For n=6 there are two penholodigital squares, 15324_6 = 2500 = 50^2 and 53241_6 = 7225 = 85^2. For n=7 there is one penholodigital square, 623514_7 = 106929 = 327^2. For n=8 there is one penholodigital square, 6532471_8 = 1750329 = 1323^2. For n=10 there are 30 penholodigital squares listed in A036744.
Links
- Chai Wah Wu, Pandigital and penholodigital numbers, arXiv:2403.20304 [math.GM], 2024. See p. 2.
Programs
-
Python
from gmpy2 import mpz, digits, isqrt def A370950(n): # requires 2 <= n <= 62 if n&1 and (~(m:=n-1>>1) & m-1).bit_length()&1: return 0 t = ''.join(digits(d,n) for d in range(1,n)) k = mpz(''.join(digits(d,n) for d in range(n-1,0,-1)),n) k2 = mpz(t,n) c = 0 for i in range(isqrt(k2),isqrt(k)+1): if i%n: j = i**2 s = ''.join(sorted(digits(j,n))) if s == t: c += 1 return c
Formula
If n is odd and n-1 has an even 2-adic valuation, then a(n) = 0 (see A258103).
Extensions
a(18) from Chai Wah Wu, Mar 07 2024
a(19) from Chai Wah Wu, Mar 15 2025
Comments