A376814 a(n) is the number of squares that have all digits distinct in base n.
2, 2, 7, 7, 21, 42, 71, 268, 611, 1352, 3099, 8471, 23877, 63564, 182771, 527001, 1671752, 5055853
Offset: 2
Examples
a(4) = 7 because the only squares with distinct digits in base 4 are 0^2 = 0_4, 1^2 = 1_4, 2^2 = 10_4, 3^2 = 21_4, 6^2 = 210_4, 7^2 = 301_4 and 15^2 = 3201_4.
Programs
-
Maple
f:= proc(b) local k,t,F; t:= 0; for k from 0 to floor(sqrt(b^b-1)) do F:= convert(k^2, base, b); if nops(F) = nops(convert(F,set)) then t:= t+1 fi; od; t end proc: map(f, [$2..12]);
-
Python
from math import isqrt from sympy.ntheory import digits def A376814(n): return sum(1 for k in range(isqrt(n**n-1)+1) if len(s:=digits(k**2,n)[1:])==len(set(s))) # Chai Wah Wu, Oct 09 2024
Extensions
a(15)-a(16) from Michael S. Branicky, Oct 09 2024
a(17) from Michael S. Branicky, Oct 10 2024
a(18) from Michael S. Branicky, Oct 14 2024
a(19) from Michael S. Branicky, Oct 31 2024
Comments