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.

A370950 Number of penholodigital squares (containing each nonzero digit exactly once) in base n.

This page as a plain text file.
%I A370950 #42 Mar 15 2025 11:54:44
%S A370950 1,0,0,0,2,1,1,10,30,20,23,0,160,419,740,0,5116,47677
%N A370950 Number of penholodigital squares (containing each nonzero digit exactly once) in base n.
%C A370950 From _Chai Wah Wu_, Mar 10 2024: (Start)
%C A370950 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.
%C A370950 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.
%C A370950 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).
%C A370950 (End)
%H A370950 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.
%F A370950 If n is odd and n-1 has an even 2-adic valuation, then a(n) = 0 (see A258103).
%e A370950 For n=2 there is one penholodigital square, 1_2 = 1 = 1^2.
%e A370950 For n=6 there are two penholodigital squares, 15324_6 = 2500 = 50^2 and 53241_6 = 7225 = 85^2.
%e A370950 For n=7 there is one penholodigital square, 623514_7 = 106929 = 327^2.
%e A370950 For n=8 there is one penholodigital square, 6532471_8 = 1750329 = 1323^2.
%e A370950 For n=10 there are 30 penholodigital squares listed in A036744.
%o A370950 (Python)
%o A370950 from gmpy2 import mpz, digits, isqrt
%o A370950 def A370950(n): # requires 2 <= n <= 62
%o A370950     if n&1 and (~(m:=n-1>>1) & m-1).bit_length()&1:
%o A370950         return 0
%o A370950     t = ''.join(digits(d,n) for d in range(1,n))
%o A370950     k = mpz(''.join(digits(d,n) for d in range(n-1,0,-1)),n)
%o A370950     k2 = mpz(t,n)
%o A370950     c = 0
%o A370950     for i in range(isqrt(k2),isqrt(k)+1):
%o A370950         if i%n:
%o A370950             j = i**2
%o A370950             s = ''.join(sorted(digits(j,n)))
%o A370950             if s == t:
%o A370950                 c += 1
%o A370950     return c
%Y A370950 Cf. A039956, A056911, A036744, A071519, A258103.
%K A370950 nonn,base,more
%O A370950 2,5
%A A370950 _Chai Wah Wu_, Mar 06 2024
%E A370950 a(18) from _Chai Wah Wu_, Mar 07 2024
%E A370950 a(19) from _Chai Wah Wu_, Mar 15 2025