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.

A137328 a(n) = prime(n) - primorial(k), where k is the greatest number for which primorial(k) <= prime(n).

This page as a plain text file.
%I A137328 #21 May 28 2025 23:10:56
%S A137328 0,1,3,1,5,7,11,13,17,23,1,7,11,13,17,23,29,31,37,41,43,49,53,59,67,
%T A137328 71,73,77,79,83,97,101,107,109,119,121,127,133,137,143,149,151,161,
%U A137328 163,167,169,1,13,17,19,23,29,31,41,47,53,59,61,67,71,73,83,97,101,103,107,121
%N A137328 a(n) = prime(n) - primorial(k), where k is the greatest number for which primorial(k) <= prime(n).
%C A137328 Conjecture: Each prime number appears in this sequence at least once.
%C A137328 Is there any general asymptotic formula for the appearance of prime(n) in this sequence?
%H A137328 Michel Marcus, <a href="/A137328/b137328.txt">Table of n, a(n) for n = 1..10000</a>
%e A137328 a(6) = prime(6) - primorial(2) = 13 - 6 = 7.
%t A137328 pn=FoldList[Times, 1, Prime[Range[5]]] (* Increase for n>343 *); a[n_]:=Module[{k=1},Until[pn[[k]]>Prime[n],k++];Prime[n]-pn[[k-1]]];Array[a,67] (* _James C. McMahon_, May 28 2025 *)
%o A137328 (PARI) a(n) = {my(p=prime(n), q=1, P=1); until (P > p, q = nextprime(q+1); P *= q;); p - P/q;} \\ _Michel Marcus_, Mar 14 2022
%o A137328 (Python)
%o A137328 from sympy import nextprime
%o A137328 from itertools import islice
%o A137328 def agen(): # generator of terms
%o A137328     pn, primk, pk, pkplus = 2, 2, 2, 3
%o A137328     while True:
%o A137328         while primk * pkplus <= pn:
%o A137328             primk, pk, pkplus = primk*pkplus, pkplus, nextprime(pkplus)
%o A137328         yield pn - primk
%o A137328         pn = nextprime(pn)
%o A137328 print(list(islice(agen(), 67))) # _Michael S. Branicky_, Mar 14 2022
%Y A137328 Cf. A000040, A002110, A136437.
%K A137328 easy,nonn
%O A137328 1,3
%A A137328 _Ctibor O. Zizka_, Apr 07 2008