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.

A107846 Number of duplicate digits of n.

This page as a plain text file.
%I A107846 #22 Jul 01 2025 00:59:40
%S A107846 0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,
%T A107846 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,
%U A107846 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0
%N A107846 Number of duplicate digits of n.
%C A107846 a(A010784(n)) = 0; a(A109303(n)) > 0. - _Reinhard Zumkeller_, Jul 09 2013
%H A107846 Reinhard Zumkeller, <a href="/A107846/b107846.txt">Table of n, a(n) for n = 0..10000</a>
%F A107846 a(n) = A055642(n) - A043537(n).
%e A107846 a(11) = 1 because 11 has two total decimal digits but only one distinct digit (1) and 2-1=1.
%e A107846 Similarly, a(3653135) = 7 (total digits) - 4 (distinct digits: 1,3,5,6) = 3 (There are three duplicate digits here, namely, 3, 3 and 5).
%t A107846 Table[Total[Select[DigitCount[n]-1,#>0&]],{n,0,120}] (* _Harvey P. Dale_, Jul 31 2013 *)
%o A107846 (Haskell)
%o A107846 import Data.List (sort, group)
%o A107846 a107846 = length . concatMap tail . group . sort . show :: Integer -> Int
%o A107846 -- _Reinhard Zumkeller_, Jul 09 2013
%o A107846 (Python)
%o A107846 def a(n): return len(s:=str(n)) - len(set(s))
%o A107846 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Jan 09 2023
%Y A107846 Cf. A055642 (Total decimal digits of n), A043537 (Distinct decimal digits of n).
%K A107846 base,easy,nonn
%O A107846 0,112
%A A107846 _Rick L. Shepherd_, May 24 2005