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.

A373802 Primes in A373801 in order of their appearance.

This page as a plain text file.
%I A373802 #23 Aug 07 2024 03:16:47
%S A373802 2,7,29,137,7937,569,179,809,227,263,557,40193,797,464897,
%T A373802 303868936193,3833,16097,4457,2309,4793,4937,10289,2693,11057,3002369,
%U A373802 52673,27617,1823,7433,1907,497153,4133,269057,2438716790407169,2879,2903,93377,2999
%N A373802 Primes in A373801 in order of their appearance.
%C A373802 a(239) has 3137 decimal digits and is too long for inclusion in the b-file. - _Alois P. Heinz_, Aug 05 2024
%H A373802 Alois P. Heinz, <a href="/A373802/b373802.txt">Table of n, a(n) for n = 1..238</a> (first 91 terms from N. J. A. Sloane)
%p A373802 b:= proc(n) option remember; (m->
%p A373802      `if`(isprime(m), ithprime(n)+1, 2*m-1))(b(n-1))
%p A373802     end: b(1):=2:
%p A373802 g:= proc(n) option remember; local k; for k from 1+g(n-1)
%p A373802       while not isprime(b(k)) do od; k
%p A373802     end: g(0):=0:
%p A373802 a:= n-> b(g(n)):
%p A373802 seq(a(n), n=1..38);  # _Alois P. Heinz_, Aug 05 2024
%t A373802 Reap[Module[{n = 1}, Nest[If[n++; PrimeQ[#], Sow[#];Prime[n] + 1, 2*# - 1] &, 2, 500]]][[2, 1]] (* _Paolo Xausa_, Aug 07 2024 *)
%o A373802 (Python)
%o A373802 from itertools import count
%o A373802 from sympy import isprime, nextprime
%o A373802 def A373802_gen(): # generator of terms
%o A373802     a, p = 2, 3
%o A373802     for i in count(1):
%o A373802         if isprime(a):
%o A373802             yield a
%o A373802             a = p+1
%o A373802         else:
%o A373802             a = (a<<1)-1
%o A373802         p = nextprime(p)
%o A373802 A373802_list = list(islice(A373802_gen(),20)) # _Chai Wah Wu_, Aug 05 2024
%Y A373802 Cf. A373801, A373803.
%K A373802 nonn
%O A373802 1,1
%A A373802 _N. J. A. Sloane_, Aug 05 2024