OFFSET
1,2
COMMENTS
a(n)=1 if and only if n-1 is in A341805. - Jeppe Stig Nielsen, Feb 20 2021
LINKS
Eric Weisstein's World of Mathematics, Primorial
FORMULA
a(1) = 1; for n>1, a(n) = ( prime(n-1)# (mod prime(n)) )^(-1), where prime(i) is the i-th prime number, prime(i)# is the product of first i primes, x^(-1) is the multiplicative inverse in the finite field F(prime(n)).
EXAMPLE
a(6)=3 because 2*3*5*7*11 = 2310, 2310 == 9 (mod 13) and 9*(9^(-1)) == 9*3 == 1 (mod 13).
MAPLE
a := n -> (1/mul(ithprime(j), j=1..n-1)) mod ithprime(n);
seq(a(n), n=1..68); # Peter Luschny, Apr 13 2014
MATHEMATICA
a[n_] := Module[{i}, Return[PowerMod[Product[Prime[i], {i, 1, n - 1}], -1, Prime[n]]]; ];
CROSSREFS
KEYWORD
nonn
AUTHOR
Valentin F. Schmid (v_schmid(AT)hotmail.com), Feb 07 2003
STATUS
approved