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.

This page as a plain text file.
%I A358351 #25 Nov 21 2022 02:58:50
%S A358351 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,
%T A358351 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,
%U A358351 1,0,0,0,1,2,0,1,1,1,0,1,0,1,1,0,0,2,0
%N A358351 Number of values of m such that m + (sum of digits of m) + (product of digits of m) is n.
%C A358351 a(n) is the number of times n occurs in A161351.
%C A358351 a(n) > 0 iff n is in A358350.
%e A358351 A161351(15) = 15 + (1+5) + (1*5) = 26 =  21 + (2+1) + (2*1) = A161351(21), so, a(26) = 2.
%t A358351 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 *)
%o A358351 (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
%o A358351 (Python)
%o A358351 from itertools import combinations_with_replacement
%o A358351 from math import prod
%o A358351 def A358351(n):
%o A358351     c = set()
%o A358351     for l in range(1,len(str(n))+1):
%o A358351         l1, l2 = 10**l, 10**(l-1)
%o A358351         for d in combinations_with_replacement(tuple(range(10)),l):
%o A358351             s, p = sum(d), prod(d)
%o A358351             if l1>(m:=n-s-p)>=l2 and sorted(int(d) for d in str(m)) == list(d):
%o A358351                 c.add(m)
%o A358351     return len(c) # _Chai Wah Wu_, Nov 20 2022
%Y A358351 Cf. A011540, A161351, A358350.
%Y A358351 Similar: A230093 (m+digitsum), A230103 (m+digitprod).
%K A358351 nonn,base
%O A358351 1,26
%A A358351 _Bernard Schott_, Nov 16 2022