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.

A121041 Number of divisors of n that are also contained in the decimal representation of n.

Original entry on oeis.org

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, 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, 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
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 21 2006

Keywords

Examples

			a(22) = #{2, 22} = 2;
a(23) = #{23} = 1;
a(24) = #{2, 4, 24} = 3.
		

Crossrefs

Programs

  • Haskell
    import Data.List (isInfixOf)
    a121041 n = length $ filter (\d -> n `mod` d == 0
                                       && show d `isInfixOf` show n) [1..n]
    -- Reinhard Zumkeller, Feb 11 2011
    
  • Mathematica
    A121041[n_] := DivisorSum[n, 1 &, StringContainsQ[IntegerString[n], IntegerString[#]] &]; Array[A121041, 150] (* Paolo Xausa, Feb 25 2024 *)
  • 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
    a(n)=sumdiv(n,d, substr(n,d)) \\ Charles R Greathouse IV, Mar 31 2016
    
  • Python
    from sympy import divisors
    def a(n):
        s = str(n)
        return sum(1 for d in divisors(n, generator=True) if str(d) in s)
    print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Jul 11 2022

Formula

a(n) = 1 iff A121042(n) = n.
a(A155005(n)) = n and a(m) < n for m < A155005(n). - Reinhard Zumkeller, Jan 18 2009