login
Product of nonzero digits of n-th prime.
4

%I #20 Mar 11 2022 07:23:18

%S 2,3,5,7,1,3,7,9,6,18,3,21,4,12,28,15,45,6,42,7,21,63,24,72,63,1,3,7,

%T 9,3,14,3,21,27,36,5,35,18,42,21,63,8,9,27,63,81,2,12,28,36,18,54,8,

%U 10,70,36,108,14,98,16,48,54,21,3,9,21,9,63,84,108,45,135,126,63,189,72,216

%N Product of nonzero digits of n-th prime.

%C First differs from A053666 in 26th term.

%F a(n) = A051801(prime(n)). - _Michel Marcus_, Mar 11 2022

%e a(25) = 63 because the 25th prime is 97 and 9 * 7 = 63.

%e a(26) = 1 because the 26th prime is 101, but we ignore the 0 and thus have 1 * 1 = 1.

%p a:= n-> mul(`if`(i=0, 1, i), i=convert(ithprime(n), base, 10)):

%p seq(a(n), n=1..77); # _Alois P. Heinz_, Mar 11 2022

%t Table[Times@@ReplaceAll[IntegerDigits[Prime[n]], 0 -> 1], {n, 80}] (* _Alonso del Arte_, Feb 28 2014 *)

%o (PARI) a(n) = vecprod(select(x->(x>1), digits(prime(n)))); \\ _Michel Marcus_, Mar 11 2022

%o (Python)

%o from math import prod

%o from sympy import sieve

%o def A051801(n): return prod(int(d) for d in str(n) if d != '0')

%o def a(n): return A051801(sieve[n])

%o print([a(n) for n in range(1, 78)]) # _Michael S. Branicky_, Mar 11 2022

%Y Cf. A051801, A053666.

%Y Cf. A038618, A056709.

%K base,easy,nonn

%O 1,1

%A _Zak Seidov_, Jan 29 2005