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.

A309432 Number of distinct digits in decimal representation of n^2.

This page as a plain text file.
%I A309432 #35 Jun 22 2022 11:46:04
%S A309432 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,
%T A309432 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,
%U A309432 3,4,3,4,4,4,4,3,3,3,4,4,3,3,4,3,4,3,4
%N A309432 Number of distinct digits in decimal representation of n^2.
%H A309432 Michael De Vlieger, <a href="/A309432/b309432.txt">Table of n, a(n) for n = 0..10000</a>
%e A309432 a(0) = 1 because 0^2 = 0 has 1 distinct digit (0).
%e A309432 a(5) = 2 because 5^2 = 25 has 2 distinct digits (2, 5).
%e A309432 a(10) = 2 because 10^2 = 100 has 2 distinct digits (0, 1).
%t A309432 Array[Count[DigitCount[#^2], _?(# > 0 &)] &, 105, 0] (* _Michael De Vlieger_, Jun 22 2022 *)
%o A309432 (SageMath)
%o A309432 [len(set(Integer((n^2)).digits(padto=1))) for n in range(25) ]
%o A309432 (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]
%o A309432 (Python)
%o A309432 def a(n): return len(set(str(n*n)))
%o A309432 print([a(n) for n in range(87)]) # _Michael S. Branicky_, Jun 22 2022
%Y A309432 Cf. A000290 (squares), A043537, A054039, A137214, A185679, A309431.
%K A309432 nonn,base,easy
%O A309432 0,5
%A A309432 _Hauke Löffler_, Aug 01 2019