Originally the Multiplicative digital root
Challenge
Basically do what the title says
Method
Given a positive integer 1 <= N <= 100000000 through one of our standard input methods, multiply every digit together, ignoring zeroes.
Ex: Take a number, say 361218402
:
3
*6
=18
18
*1
=18
18
*2
=36
36
*1
=36
36
*8
=288
288
*4
=1152
1152
*1
(ignore zeroes or turn them into ones) =1152
1152
*2
=2304
The output for 361218402
is 2304
Note: Treat the digit 0
in numbers as 1
.
Test Cases
1 => 1 10 => 1 20 => 2 100 => 1 999 => 729 21333 => 54 17801 => 56 4969279 => 244944 100000000 => 1
Standard Loopholes are disallowed, and this is code-golf, so shortest byte count wins!
Congrats to Jo King who got the bounty with his 70 byte brain-flak answer!
100000000000
I suggest the test case99999999999 => 31381059609
, since it doesn't fit in a default 32-bit integer. Perhaps better would be to lower the maximum output to a 32-bit maximum (2147483647). \$\endgroup\$