login
A309432
Number of distinct digits in decimal representation of n^2.
1
1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 2, 3, 3, 3, 3, 2, 2, 2, 3, 3, 3, 2, 3, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 2, 3, 3, 3, 4, 4, 4, 3, 3, 3, 4, 4, 3, 4, 4, 4, 4, 4, 3, 4, 3, 4, 3, 4, 3, 3, 4, 3, 4, 3, 3, 4, 3, 4, 4, 4, 4, 3, 3, 3, 4, 4, 3, 3, 4, 3, 4, 3, 4
OFFSET
0,5
LINKS
EXAMPLE
a(0) = 1 because 0^2 = 0 has 1 distinct digit (0).
a(5) = 2 because 5^2 = 25 has 2 distinct digits (2, 5).
a(10) = 2 because 10^2 = 100 has 2 distinct digits (0, 1).
MATHEMATICA
Array[Count[DigitCount[#^2], _?(# > 0 &)] &, 105, 0] (* Michael De Vlieger, Jun 22 2022 *)
PROG
(SageMath)
[len(set(Integer((n^2)).digits(padto=1))) for n in range(25) ]
(PARI) a(n) = if(n==0, 1, #Set(digits(n^2))); \\ Jinyuan Wang, Aug 02 2019, Jun 22 2022 [a(0)=1 corrected by Georg Fischer, Jun 22 2022]
(Python)
def a(n): return len(set(str(n*n)))
print([a(n) for n in range(87)]) # Michael S. Branicky, Jun 22 2022
CROSSREFS
Sequence in context: A151963 A191291 A131841 * A230261 A242306 A245636
KEYWORD
nonn,base,easy
AUTHOR
Hauke Löffler, Aug 01 2019
STATUS
approved