cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A334085 GCD of n and the product of all primes < n.

This page as a plain text file.
%I A334085 #33 Jun 07 2023 21:29:42
%S A334085 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,
%T A334085 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,
%U A334085 57,58,1,30,1,62,21,2,65,66,1,34,69,70,1,6,1,74,15
%N A334085 GCD of n and the product of all primes < n.
%C A334085 a(n) = 1 iff n is prime or n = 1.
%H A334085 Alois P. Heinz, <a href="/A334085/b334085.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Christoph Schreier)
%F A334085 a(n) = gcd(n, A034386(n-1)).
%F A334085 a(n) = 1 if n is prime, else a(n) = A007947(n).
%e A334085 For n=8 the product of all primes < 8 = A034386(7) = 210; gcd(8,210) = 2.
%p A334085 a:= n-> `if`(isprime(n), 1, mul(i[1], i=ifactors(n)[2])):
%p A334085 seq(a(n), n=1..80);  # _Alois P. Heinz_, Apr 17 2020
%t A334085 a[n_] := GCD[n, Times @@ Select[Range[n - 1], PrimeQ]]; Array[a, 60] (* _Amiram Eldar_, Apr 14 2020 *)
%o A334085 (Python)
%o A334085 def is_prime(n):
%o A334085     if n == 2 or n == 3:
%o A334085         return True
%o A334085     if n % 2 == 0 or n < 2:
%o A334085         return False
%o A334085     for i in range(3,int(n**0.5)+1,2):
%o A334085         if n % i == 0:
%o A334085             return False
%o A334085     return True
%o A334085 def A(n):
%o A334085     if n < 3:
%o A334085         raise ValueError('n must be > 2')
%o A334085     else:
%o A334085         a = 1
%o A334085         for i in range(n):
%o A334085             if is_prime(i):
%o A334085                 a *= i
%o A334085     return math.gcd(n,a)
%o A334085 (PARI) a(n) = gcd(n, prod(k=1, n-1, if (isprime(k), k, 1))); \\ _Michel Marcus_, Apr 14 2020
%o A334085 (PARI) a(n,f=factor(n))=if(f[,2]==[1]~,1,factorback(f[,1])) \\ _Charles R Greathouse IV_, Apr 14 2020
%Y A334085 Cf. A000040, A034386, A007947.
%K A334085 nonn,easy
%O A334085 1,4
%A A334085 _Christoph Schreier_, Apr 14 2020