login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A334085 GCD of n and the product of all primes < n. 1
1, 1, 1, 2, 1, 6, 1, 2, 3, 10, 1, 6, 1, 14, 15, 2, 1, 6, 1, 10, 21, 22, 1, 6, 5, 26, 3, 14, 1, 30, 1, 2, 33, 34, 35, 6, 1, 38, 39, 10, 1, 42, 1, 22, 15, 46, 1, 6, 7, 10, 51, 26, 1, 6, 55, 14, 57, 58, 1, 30, 1, 62, 21, 2, 65, 66, 1, 34, 69, 70, 1, 6, 1, 74, 15 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
COMMENTS
a(n) = 1 iff n is prime or n = 1.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000 (first 1000 terms from Christoph Schreier)
FORMULA
a(n) = gcd(n, A034386(n-1)).
a(n) = 1 if n is prime, else a(n) = A007947(n).
EXAMPLE
For n=8 the product of all primes < 8 = A034386(7) = 210; gcd(8,210) = 2.
MAPLE
a:= n-> `if`(isprime(n), 1, mul(i[1], i=ifactors(n)[2])):
seq(a(n), n=1..80); # Alois P. Heinz, Apr 17 2020
MATHEMATICA
a[n_] := GCD[n, Times @@ Select[Range[n - 1], PrimeQ]]; Array[a, 60] (* Amiram Eldar, Apr 14 2020 *)
PROG
(Python)
def is_prime(n):
if n == 2 or n == 3:
return True
if n % 2 == 0 or n < 2:
return False
for i in range(3, int(n**0.5)+1, 2):
if n % i == 0:
return False
return True
def A(n):
if n < 3:
raise ValueError('n must be > 2')
else:
a = 1
for i in range(n):
if is_prime(i):
a *= i
return math.gcd(n, a)
(PARI) a(n) = gcd(n, prod(k=1, n-1, if (isprime(k), k, 1))); \\ Michel Marcus, Apr 14 2020
(PARI) a(n, f=factor(n))=if(f[, 2]==[1]~, 1, factorback(f[, 1])) \\ Charles R Greathouse IV, Apr 14 2020
CROSSREFS
Sequence in context: A085099 A193807 A225766 * A249831 A304527 A321725
KEYWORD
nonn,easy
AUTHOR
Christoph Schreier, Apr 14 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 14:35 EDT 2024. Contains 371989 sequences. (Running on oeis4.)