OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
248 is a term as the geometric mean of digits is (2*4*8) = 64 = 4^3.
PROG
(Haskell)
a061428 n = a061428_list !! (n-1)
a061428_list = g [1] where
g ds = if product ds == 4 ^ length ds
then foldr (\d v -> 10 * v + d) 0 ds : g (s ds) else g (s ds)
s [] = [1]; s (8:ds) = 1 : s ds; s (d:ds) = 2*d : ds
-- Reinhard Zumkeller, Jan 13 2014
(Python)
from math import prod
from sympy.utilities.iterables import multiset_combinations, multiset_permutations
def auptod(maxdigits):
n, digs, alst, powsexps2 = 0, 1, [], [(1, 0), (2, 1), (4, 2), (8, 3)]
for digs in range(1, maxdigits+1):
target, okdigs = 4**digs, set()
mcstr = "".join(str(d)*(digs//max(1, r//2)) for d, r in powsexps2)
for mc in multiset_combinations(mcstr, digs):
if prod(map(int, mc)) == target:
n += 1
okdigs |= set("".join(mp) for mp in multiset_permutations(mc, digs))
alst += sorted(map(int, okdigs))
return alst
print(auptod(4)) # Michael S. Branicky, Apr 28 2021
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Amarnath Murthy, May 03 2001
EXTENSIONS
More terms from Larry Reeves (larryr(AT)acm.org), May 16 2001
STATUS
approved