A028846 Numbers whose product of digits is a power of 2.
1, 2, 4, 8, 11, 12, 14, 18, 21, 22, 24, 28, 41, 42, 44, 48, 81, 82, 84, 88, 111, 112, 114, 118, 121, 122, 124, 128, 141, 142, 144, 148, 181, 182, 184, 188, 211, 212, 214, 218, 221, 222, 224, 228, 241, 242, 244, 248, 281, 282, 284, 288, 411, 412, 414, 418, 421, 422, 424, 428, 441, 442, 444, 448
Offset: 1
Examples
28 is in the sequence because 2*8 = 2^4. - _Michel Lagneau_, Dec 01 2010
Links
- Bo Gyu Jeong, Table of n, a(n) for n = 1..5000
Programs
-
Haskell
a028846 n = a028846_list !! (n-1) a028846_list = f [1] where f ds = foldr (\d v -> 10 * v + d) 0 ds : f (s ds) s [] = [1]; s (8:ds) = 1 : s ds; s (d:ds) = 2*d : ds -- Reinhard Zumkeller, Jan 13 2014
-
Mathematica
Select[Range[1000], IntegerQ[Log[2, Times @@ (IntegerDigits[#])]] &] (* Michel Lagneau, Dec 01 2010 *)
-
PARI
is(n)=#setminus(Set(digits(n)), [1,2,4,8])==0 \\ Charles R Greathouse IV, Apr 24 2025
-
Python
from itertools import count, islice, product def agen(): yield from (int("".join(p)) for d in count(1) for p in product("1248", repeat=d)) print(list(islice(agen(), 64))) # Michael S. Branicky, Aug 21 2022
-
Python
def A028846(n): m = (k:=3*n+1).bit_length()-1>>1 return sum(10**j<<((k-(1<<(m<<1)))//(3<<(j<<1))&3) for j in range(m)) # Chai Wah Wu, Jun 28 2025
Formula
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
Extensions
More terms from Scott Lindhurst (ScottL(AT)alumni.princeton.edu)
Comments