%I #15 Jul 25 2022 01:12:06
%S 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,73,79,83,89,97,
%T 103,107,113,127,131,137,139,149,157,163,167,173,179,193,197,199,211,
%U 223,227,251,257,263,271,277,281,293,307,313,317,331,337,347,353
%N Sequence (or tree) T of primes generated by these rules: 2 is in T; if p is in T, then the greatest prime < 2*p is in T; if p is in T, then the least prime > 2*p is in T; duplicates are deleted as they occur.
%C The rules generate successive generations g(n) as follows: g(1) = (2), which begets 3 and 5, so that g(2) = (3,5); then g(3) = (7,11); g(4) = (13,17,19,23); etc. The number of primes in g(n) is given by A234961, and primes not generated, beginning with 71, are given by A234962. Conjecture: the limiting relative density of generated primes is 0.
%H Clark Kimberling, <a href="/A234960/b234960.txt">Table of n, a(n) for n = 1..4000</a>
%e Starting with 2, the greatest prime less than 2*2 is 3, and the least prime greater than 2*2 is 5.
%t t = NestList[DeleteDuplicates[Flatten[Map[{#, NextPrime[2 #, -1], NextPrime[2 #, 1]} &, #]]] &, {2}, 9]; g = Join[{{2}}, Map[Complement[t[[# + 1]], t[[#]]] &, Range[Length[t] - 1]]]
%t Flatten[g] (* A234960 *) (* _Peter J. C. Moses_, Dec 30 2013 *)
%o (Python)
%o from sympy import prevprime, nextprime
%o def aupto(limit):
%o reach, expand = {2}, [2]
%o while True:
%o newreach = set()
%o while len(expand) > 0:
%o p = expand.pop()
%o for q in prevprime(2*p), nextprime(2*p):
%o if q not in reach:
%o newreach.add(q)
%o reach |= newreach
%o expand = list(newreach)
%o if prevprime(2*min(expand)) > limit:
%o return sorted(r for r in reach if r <= limit)
%o print(aupto(353)) # _Michael S. Branicky_, Jul 24 2022
%Y Cf. A234961, A234962.
%K nonn,easy
%O 1,1
%A _Clark Kimberling_, Jan 01 2014
|