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.

A373803 Indices of primes in A373801.

This page as a plain text file.
%I A373803 #25 Aug 07 2024 03:37:50
%S A373803 1,3,6,10,19,23,25,29,31,33,36,45,48,60,91,95,101,105,108,112,116,121,
%T A373803 124,129,142,149,155,157,161,163,173,176,185,227,229,231,238,240,386,
%U A373803 391,393,398,411,415,435,439,466,537,543,565,570,575,577,588,592,687,694,696,700,733,738,759
%N A373803 Indices of primes in A373801.
%H A373803 Alois P. Heinz, <a href="/A373803/b373803.txt">Table of n, a(n) for n = 1..442</a> (first 91 terms from N. J. A. Sloane)
%p A373803 b:= proc(n) option remember; (m->
%p A373803      `if`(isprime(m), ithprime(n)+1, 2*m-1))(b(n-1))
%p A373803     end: b(1):=2:
%p A373803 a:= proc(n) option remember; local k; for k from 1+a(n-1)
%p A373803       while not isprime(b(k)) do od; k
%p A373803     end: a(0):=0:
%p A373803 seq(a(n), n=1..62);  # _Alois P. Heinz_, Aug 05 2024
%t A373803 Reap[Module[{n = 1}, Nest[If[n++; PrimeQ[#], Sow[n-1]; Prime[n] + 1, 2*# - 1] &, 2, 1000]]][[2,1]] (* _Paolo Xausa_, Aug 07 2024 *)
%o A373803 (Python)
%o A373803 from itertools import count
%o A373803 from sympy import isprime, nextprime
%o A373803 def A373803_gen(): # generator of terms
%o A373803     a, p = 2, 3
%o A373803     for i in count(1):
%o A373803         if isprime(a):
%o A373803             yield i
%o A373803             a = p+1
%o A373803         else:
%o A373803             a = (a<<1)-1
%o A373803         p = nextprime(p)
%o A373803 A373803_list = list(islice(A373803_gen(),20)) # _Chai Wah Wu_, Aug 05 2024
%Y A373803 Cf. A373801, A373802.
%K A373803 nonn
%O A373803 1,2
%A A373803 _N. J. A. Sloane_, Aug 05 2024