%I #31 Oct 09 2022 21:26:15
%S 1,2,4,8,11,12,14,18,21,22,24,28,41,42,44,48,81,82,84,88,111,112,114,
%T 118,121,122,124,128,141,142,144,148,181,182,184,188,211,212,214,218,
%U 221,222,224,228,241,242,244,248,281,282,284,288,411,412,414,418,421,422,424,428,441,442,444,448
%N Numbers whose product of digits is a power of 2.
%C Numbers using only digits 1, 2, 4, and 8. - _Michel Lagneau_, Dec 01 2010
%H Bo Gyu Jeong, <a href="/A028846/b028846.txt">Table of n, a(n) for n = 1..5000</a>
%F Given a(0) = 0 and n = 4k - r, where 0 <= r <= 3, a(n) = 10*a(k-1) + 2^(3-r). - _Clinton H. Dan_, Aug 21 2022
%e 28 is in the sequence because 2*8 = 2^4. - _Michel Lagneau_, Dec 01 2010
%t Select[Range[1000], IntegerQ[Log[2, Times @@ (IntegerDigits[#])]] &] (* _Michel Lagneau_, Dec 01 2010 *)
%o (Haskell)
%o a028846 n = a028846_list !! (n-1)
%o a028846_list = f [1] where
%o f ds = foldr (\d v -> 10 * v + d) 0 ds : f (s ds)
%o s [] = [1]; s (8:ds) = 1 : s ds; s (d:ds) = 2*d : ds
%o -- _Reinhard Zumkeller_, Jan 13 2014
%o (Python)
%o from itertools import count, islice, product
%o def agen(): yield from (int("".join(p)) for d in count(1) for p in product("1248", repeat=d))
%o print(list(islice(agen(), 64))) # _Michael S. Branicky_, Aug 21 2022
%Y Cf. A007954, A028889, A028838.
%Y Cf. A174813, A061426.
%K nonn,base
%O 1,2
%A _N. J. A. Sloane_
%E More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)
|