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.

A230103 Number of m such that m + (product of digits of m) equals n.

This page as a plain text file.
%I A230103 #23 Jan 09 2023 10:41:37
%S A230103 1,0,1,0,1,0,1,0,1,0,2,0,2,0,2,0,2,0,2,0,2,0,1,1,1,0,2,0,1,1,1,0,1,0,
%T A230103 1,1,0,0,2,0,1,1,1,0,1,1,1,1,0,0,3,0,0,0,1,1,1,0,1,0,2,0,2,0,0,1,1,1,
%U A230103 1,0,2,0,0,0,2,1,0,0,1,0,3,1,0,0,0,1,2,0,1,1,1,0,1,0,1,1,0,0,2,0,2,1,3
%N A230103 Number of m such that m + (product of digits of m) equals n.
%C A230103 Number of times n appears in A230099.
%H A230103 Michel Marcus, <a href="/A230103/b230103.txt">Table of n, a(n) for n = 0..10000</a>
%H A230103 <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a>
%p A230103 # Maple code for A230099, A230103, A230104, A230105
%p A230103 with(LinearAlgebra):
%p A230103 read transforms; # to get digprod
%p A230103 M:=1000;
%p A230103 lis1:=Array(0..M);
%p A230103 lis2:=Array(0..M);
%p A230103 ctmax:=4;
%p A230103 for i from 0 to ctmax do ct[i]:=Array(0..M); od:
%p A230103 for n from 0 to M do
%p A230103 m:=n+digprod(n);
%p A230103 lis1[n]:=m;
%p A230103 if (m <= M) then lis2[m]:=lis2[m]+1; fi;
%p A230103 od:
%p A230103 t1:=[seq(lis1[i],i=0..M)]; # A230099
%p A230103 t2:=[seq(lis2[i],i=0..M)]; # A230103
%p A230103 COMPl(t1); # A230104
%p A230103 for i from 1 to M do h:=lis2[i];
%p A230103 if h <= ctmax then ct[h]:=[op(ct[h]),i]; fi; od:
%p A230103 len:=nops(ct[0]); [seq(ct[0][i],i=1..len)]; # A230104 again
%p A230103 len:=nops(ct[1]); [seq(ct[1][i],i=1..len)]; # A230105
%o A230103 (PARI) a(n) = if (n==0, return(1)); sum(k=1, n, k+vecprod(digits(k)) == n); \\ _Michel Marcus_, Sep 18 2020
%o A230103 (Python)
%o A230103 from math import prod
%o A230103 def b(n): return n + prod(map(int, str(n)))
%o A230103 def a(n): return sum(1 for m in range(n+1) if b(m) == n)
%o A230103 print([a(n) for n in range(103)]) # _Michael S. Branicky_, Jan 09 2023
%o A230103 (Python) # faster version for initial segment of sequence
%o A230103 from math import prod
%o A230103 from collections import Counter
%o A230103 def b(n): return n + prod(map(int, str(n)))
%o A230103 def aupto(n):
%o A230103     c = Counter(b(m) for m in range(n+1))
%o A230103     return [c[k] for k in range(n+1)]
%o A230103 print(aupto(102)) # _Michael S. Branicky_, Jan 09 2023
%Y A230103 Cf. A230099, A230104.
%K A230103 nonn,base
%O A230103 0,11
%A A230103 _N. J. A. Sloane_, Oct 13 2013