%I #26 Jan 14 2023 03:09:45
%S 2,3,5,1,7,8,11,13,10,17,19,14,23,29,16,31,37,20,41,43,22,47,53,25,59,
%T 27,61,30,67,71,73,33,79,35,83,38,89,97,40,101
%N A sequence S describing the position of its prime terms.
%C S reads like this:
%C "At position 2, there is a prime in S" [indeed, this is 3]
%C "At position 3, there is a prime in S" [indeed, this is 5]
%C "At position 5, there is a prime in S" [indeed, this is 7]
%C "At position 1, there is a prime in S" [indeed, this is 2]
%C "At position 7, there is a prime in S" [indeed, this is 11]
%C "At position 8, there is a prime in S" [indeed, this is 13]
%C "At position 11, there is a prime in S" [indeed, this is 19]
%C "At position 13, there is a prime in S" [indeed, this is 23]
%C "At position 10, there is a prime in S" [indeed, this is 17], etc.
%C S is built with this rule: when you are about to write a term of S, always use the smallest integer not yet present in S and not leading to a contradiction.
%C Thus one cannot start with 1; this would read: "At position 1, there is a prime number in S" [no, 1 is not a prime]
%C So start S with 2 and the rest follows smoothly.
%C S contains all the primes and they appear in their natural order.
%C Does the ratio primes/composites in S tend to a limit? Answer (from _Dean Hickerson_): Yes, to 1/2.
%C Comments from _Dean Hickerson_, Aug 11 2006: (Start)
%C In the limit, exactly half of the terms are primes. Here's a formula, found empirically, for a(n) for n >= 5:
%C Let pi(n) be the number of primes <= n and p(n) be the n-th prime. Then:
%C - if n is prime or (n is composite and n+pi(n) is even) then a(n) = p(floor((n+pi(n))/2));
%C - if n is composite and n+pi(n) is odd and n+1 is composite then a(n) = n+1;
%C - if n is composite and n+pi(n) is odd and n+1 is prime then a(n) = n+2.
%C Also, for n >= 5, n is in the sequence iff either n is prime or n+pi(n) is even.
%C (This could all be proved by induction on n.)
%C It follows from this that, for n >= 4, the number of primes among a(1), ..., a(n) is exactly floor((n+pi(n))/2. Since pi(n)/n -> 0 as n -> infinity, this is asymptotic to n/2. (End)
%H Kerry Mitchell, <a href="/A121053/b121053.txt">Table of n, a(n) for n = 1..1000</a>
%H Eric Angelini, <a href="http://www.cetteadressecomportecinquantesignes.com/PrimePos.htm">About this sequence</a>
%H E. Angelini, <a href="/A121053/a121053.png">A sequence describing the position of its prime terms</a> [Cached, with permission]
%H N. J. A. Sloane, <a href="https://arxiv.org/abs/2301.03149">"A Handbook of Integer Sequences" Fifty Years Later</a>, arXiv:2301.03149 [math.NT], 2023, p. 9.
%t a[1]=2; a[2]=3; a[3]=5; a[4]=1; a[n_ /; PrimeQ[n] || !PrimeQ[n] && EvenQ[n+PrimePi[n]]] := Prime[Floor[(n+PrimePi[n])/2]]; a[n_ /; !PrimeQ[n] && OddQ[n+PrimePi[n]]] := If[!PrimeQ[n+1],n+1,n+2]; Table[a[n],{n,1,40}] (* _Jean-François Alcover_, Mar 21 2011, after _Dean Hickerson_'s empirical formula *)
%Y Cf. A105753.
%K nonn,nice
%O 1,1
%A _Eric Angelini_, Aug 10 2006
|