login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A370950
Number of penholodigital squares (containing each nonzero digit exactly once) in base n.
1
1, 0, 0, 0, 2, 1, 1, 10, 30, 20, 23, 0, 160, 419, 740, 0, 5116
OFFSET
2,5
COMMENTS
From Chai Wah Wu, Mar 10 2024: (Start)
Theorem: Let m^2 be a pandigital square (containing each digit exactly once) or a penholodigital square (containing each nonzero digit exactly once) in base n. If n-1 is an odd squarefree number (A056911), then m is divisible by n-1. If n-1 is an even squarefree number (A039956), then m-(n-1)/2 is divisible by n-1.
Proof: Since n^k == 1 (mod n-1), and the sum of digits of m^2 is n*(n-1)/2, this implies that m^2 == n*(n-1)/2 (mod n-1). If n-1 is odd and squarefree, then n is even and m^2 == 0 (mod n-1). Since n-1 = Product_i p_i for distinct odd primes p_i, and m^2 == 0 (mod p_i) if and only if m == 0 (mod p_i), this implies that m == 0 (mod n-1) by the Chinese Remainder Theorem.
Similarly, if n-1 is even and squarefree, then m^2 == n(n-1)/2 == (n-1)/2 (mod n-1) and (n-1)/2 = Product_i p_i for distinct odd primes p_i, i.e., m^2 == 0 (mod p_i) and m^2 == 1 (mod 2). This implies that m == 0 (mod p_i) and m == 1 (mod 2). Again by the Chinese Remainder Theorem, m == (n-1)/2 (mod n-1).
(End)
LINKS
Chai Wah Wu, Pandigital and penholodigital numbers, arXiv:2403.20304 [math.GM], 2024. See p. 2.
FORMULA
If n is odd and n-1 has an even 2-adic valuation, then a(n) = 0 (see A258103).
EXAMPLE
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 = 195^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.
PROG
(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
CROSSREFS
KEYWORD
nonn,base,more
AUTHOR
Chai Wah Wu, Mar 06 2024
EXTENSIONS
a(18) from Chai Wah Wu, Mar 07 2024
STATUS
approved