OFFSET
0,5
LINKS
Michael De Vlieger, Table of n, a(n) for n = 0..10000
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
KEYWORD
nonn,base,easy
AUTHOR
Hauke Löffler, Aug 01 2019
STATUS
approved