%I #31 Feb 26 2024 10:10:10
%S 1,1,1,1,1,1,1,1,1,2,2,3,2,2,3,2,2,2,2,2,2,2,1,3,2,2,1,2,1,2,2,2,2,1,
%T 2,3,1,1,2,2,2,2,1,2,2,1,1,3,1,2,2,2,1,1,2,1,1,1,1,2,2,2,2,2,2,2,1,1,
%U 1,2,2,2,1,1,2,1,2,1,1,2,2,2,1,2,2,1,1,2,1,2,2,2,2,1,2,2,1,1,2,3,2,3,2,3,3
%N Number of divisors of n that are also contained in the decimal representation of n.
%H Reinhard Zumkeller, <a href="/A121041/b121041.txt">Table of n, a(n) for n = 1..10000</a>
%F a(n) = 1 iff A121042(n) = n.
%F a(A155005(n)) = n and a(m) < n for m < A155005(n). - _Reinhard Zumkeller_, Jan 18 2009
%e a(22) = #{2, 22} = 2;
%e a(23) = #{23} = 1;
%e a(24) = #{2, 4, 24} = 3.
%t A121041[n_] := DivisorSum[n, 1 &, StringContainsQ[IntegerString[n], IntegerString[#]] &]; Array[A121041, 150] (* _Paolo Xausa_, Feb 25 2024 *)
%o (Haskell)
%o import Data.List (isInfixOf)
%o a121041 n = length $ filter (\d -> n `mod` d == 0
%o && show d `isInfixOf` show n) [1..n]
%o -- _Reinhard Zumkeller_, Feb 11 2011
%o (PARI) substr(a,b)=a=digits(a); b=digits(b); for(i=0,#a-#b, for(j=1,#b, if(a[i+j]!=b[j], next(2))); return(1)); 0
%o a(n)=sumdiv(n,d, substr(n,d)) \\ _Charles R Greathouse IV_, Mar 31 2016
%o (Python)
%o from sympy import divisors
%o def a(n):
%o s = str(n)
%o return sum(1 for d in divisors(n, generator=True) if str(d) in s)
%o print([a(n) for n in range(1, 106)]) # _Michael S. Branicky_, Jul 11 2022
%Y Cf. A121022, A121023, A121024, A121025, A121026, A121027, A121028, A121029, A121030, A121031, A121032, A121033, A121034, A121035, A121036, A121037, A121038, A121039, A121040.
%K nonn,base,easy
%O 1,10
%A _Reinhard Zumkeller_, Jul 21 2006