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!)
A373802 Primes in A373801 in order of their appearance. 3

%I #23 Aug 07 2024 03:16:47

%S 2,7,29,137,7937,569,179,809,227,263,557,40193,797,464897,

%T 303868936193,3833,16097,4457,2309,4793,4937,10289,2693,11057,3002369,

%U 52673,27617,1823,7433,1907,497153,4133,269057,2438716790407169,2879,2903,93377,2999

%N Primes in A373801 in order of their appearance.

%C a(239) has 3137 decimal digits and is too long for inclusion in the b-file. - _Alois P. Heinz_, Aug 05 2024

%H 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 b:= proc(n) option remember; (m->

%p `if`(isprime(m), ithprime(n)+1, 2*m-1))(b(n-1))

%p end: b(1):=2:

%p g:= proc(n) option remember; local k; for k from 1+g(n-1)

%p while not isprime(b(k)) do od; k

%p end: g(0):=0:

%p a:= n-> b(g(n)):

%p seq(a(n), n=1..38); # _Alois P. Heinz_, Aug 05 2024

%t Reap[Module[{n = 1}, Nest[If[n++; PrimeQ[#], Sow[#];Prime[n] + 1, 2*# - 1] &, 2, 500]]][[2, 1]] (* _Paolo Xausa_, Aug 07 2024 *)

%o (Python)

%o from itertools import count

%o from sympy import isprime, nextprime

%o def A373802_gen(): # generator of terms

%o a, p = 2, 3

%o for i in count(1):

%o if isprime(a):

%o yield a

%o a = p+1

%o else:

%o a = (a<<1)-1

%o p = nextprime(p)

%o A373802_list = list(islice(A373802_gen(),20)) # _Chai Wah Wu_, Aug 05 2024

%Y Cf. A373801, A373803.

%K nonn

%O 1,1

%A _N. J. A. Sloane_, Aug 05 2024

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 September 13 19:11 EDT 2024. Contains 375910 sequences. (Running on oeis4.)