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.

A358351 Number of values of m such that m + (sum of digits of m) + (product of digits of m) is n.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 0, 2, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 3, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 2, 0, 0, 1, 1, 1, 1, 0, 2, 0, 0, 0, 2, 1, 0, 0, 1, 0, 2, 1, 0, 0, 0, 1, 2, 0, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, 2, 0
Offset: 1

Views

Author

Bernard Schott, Nov 16 2022

Keywords

Comments

a(n) is the number of times n occurs in A161351.
a(n) > 0 iff n is in A358350.

Examples

			A161351(15) = 15 + (1+5) + (1*5) = 26 =  21 + (2+1) + (2*1) = A161351(21), so, a(26) = 2.
		

Crossrefs

Similar: A230093 (m+digitsum), A230103 (m+digitprod).

Programs

  • Mathematica
    f[n_] := n + Total[(d = IntegerDigits[n])] + Times @@ d; With[{m = 100}, BinCounts[Table[f[n], {n, 1, m}], {1, m, 1}]] (* Amiram Eldar, Nov 16 2022 *)
  • PARI
    first(n) = {my(res = vector(n)); for(i = 1, n, c = i + sumdigits(i) + vecprod(digits(i)); if(c <= n, res[c]++ ) ); res } \\ David A. Corneth, Nov 16 2022
    
  • Python
    from itertools import combinations_with_replacement
    from math import prod
    def A358351(n):
        c = set()
        for l in range(1,len(str(n))+1):
            l1, l2 = 10**l, 10**(l-1)
            for d in combinations_with_replacement(tuple(range(10)),l):
                s, p = sum(d), prod(d)
                if l1>(m:=n-s-p)>=l2 and sorted(int(d) for d in str(m)) == list(d):
                    c.add(m)
        return len(c) # Chai Wah Wu, Nov 20 2022