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.

A056770 Smallest number that is n times the product of its digits or 0 if impossible.

This page as a plain text file.
%I A056770 #21 May 09 2023 19:44:25
%S A056770 1,36,15,384,175,12,735,128,135,0,11,1296,624,224,0,0,816,216,1197,0,
%T A056770 315,132,115,0,0,0,2916,1176,3915,0,93744,0,51975,78962688,0,82944,
%U A056770 1184,0,0,0,31488,0,0,77616,77175,4416,0,12288,1715,0,612
%N A056770 Smallest number that is n times the product of its digits or 0 if impossible.
%H A056770 David W. Wilson, <a href="/A056770/b056770.txt">Table of n, a(n) for n = 1..1000</a>
%e A056770 a(4) = 384 because 4*(product of digits of 384) = 4*96 = 384, and no number smaller than 384 has this property.
%t A056770 Do[k = n; If[Mod[n, 10] == 0, Print[0]; Continue[]]; While[Apply[Times, RealDigits[k][[1]]]*n != k, k += n]; Print[k], {n, 1, 14}]
%o A056770 (Python)
%o A056770 from itertools import count, combinations_with_replacement
%o A056770 from math import prod
%o A056770 def A056770(n):
%o A056770     if not n%10: return 0
%o A056770     for l in count(1):
%o A056770         if 9**l*n < 10**(l-1): return 0
%o A056770         c = 10**l
%o A056770         for d in combinations_with_replacement(range(1,10),l):
%o A056770             if sorted(str(a:=prod(d)*n)) == list(str(e) for e in d):
%o A056770                 c = min(c,a)
%o A056770         if c < 10**l:
%o A056770             return c # _Chai Wah Wu_, May 09 2023
%Y A056770 Cf. A007954, A007602, A003634.
%K A056770 nonn,base
%O A056770 1,2
%A A056770 _Robert G. Wilson v_, Aug 16 2000
%E A056770 a(15) onwards from _David W. Wilson_, Jan 20 2016