Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A101987
Product of nonzero digits of n-th prime.
4
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, 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, 10, 70, 36, 108, 14, 98, 16, 48, 54, 21, 3, 9, 21, 9, 63, 84, 108, 45, 135, 126, 63, 189, 72, 216
OFFSET
1,1
COMMENTS
First differs from A053666 in 26th term.
FORMULA
a(n) = A051801(prime(n)). - Michel Marcus, Mar 11 2022
EXAMPLE
a(25) = 63 because the 25th prime is 97 and 9 * 7 = 63.
a(26) = 1 because the 26th prime is 101, but we ignore the 0 and thus have 1 * 1 = 1.
MAPLE
a:= n-> mul(`if`(i=0, 1, i), i=convert(ithprime(n), base, 10)):
seq(a(n), n=1..77); # Alois P. Heinz, Mar 11 2022
MATHEMATICA
Table[Times@@ReplaceAll[IntegerDigits[Prime[n]], 0 -> 1], {n, 80}] (* Alonso del Arte, Feb 28 2014 *)
PROG
(PARI) a(n) = vecprod(select(x->(x>1), digits(prime(n)))); \\ Michel Marcus, Mar 11 2022
(Python)
from math import prod
from sympy import sieve
def A051801(n): return prod(int(d) for d in str(n) if d != '0')
def a(n): return A051801(sieve[n])
print([a(n) for n in range(1, 78)]) # Michael S. Branicky, Mar 11 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Zak Seidov, Jan 29 2005
STATUS
approved