login
Geometric mean of the digits = 4. In other words, the product of the digits is = 4^k where k is the number of digits.
4

%I #17 Jan 19 2023 01:42:17

%S 4,28,44,82,188,248,284,428,444,482,818,824,842,881,1488,1848,1884,

%T 2288,2448,2484,2828,2844,2882,4188,4248,4284,4428,4444,4482,4818,

%U 4824,4842,4881,8148,8184,8228,8244,8282,8418,8424,8442,8481,8814,8822,8841,12888

%N Geometric mean of the digits = 4. In other words, the product of the digits is = 4^k where k is the number of digits.

%H Reinhard Zumkeller, <a href="/A061428/b061428.txt">Table of n, a(n) for n = 1..10000</a>

%e 248 is a term as the geometric mean of digits is (2*4*8) = 64 = 4^3.

%o (Haskell)

%o a061428 n = a061428_list !! (n-1)

%o a061428_list = g [1] where

%o g ds = if product ds == 4 ^ length ds

%o then foldr (\d v -> 10 * v + d) 0 ds : g (s ds) else g (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 math import prod

%o from sympy.utilities.iterables import multiset_combinations, multiset_permutations

%o def auptod(maxdigits):

%o n, digs, alst, powsexps2 = 0, 1, [], [(1, 0), (2, 1), (4, 2), (8, 3)]

%o for digs in range(1, maxdigits+1):

%o target, okdigs = 4**digs, set()

%o mcstr = "".join(str(d)*(digs//max(1, r//2)) for d, r in powsexps2)

%o for mc in multiset_combinations(mcstr, digs):

%o if prod(map(int, mc)) == target:

%o n += 1

%o okdigs |= set("".join(mp) for mp in multiset_permutations(mc, digs))

%o alst += sorted(map(int, okdigs))

%o return alst

%o print(auptod(4)) # _Michael S. Branicky_, Apr 28 2021

%Y Cf. A061426, A061427, A061429, A061430.

%Y Cf. A028846, A069518.

%K nonn,base,easy

%O 1,1

%A _Amarnath Murthy_, May 03 2001

%E More terms from Larry Reeves (larryr(AT)acm.org), May 16 2001