Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #26 Nov 01 2021 03:21:40
%S 11,1,6,3,10,1,3,6,5,3,2,3,2,1,9,1,6,3,3,2,1,5,1,4,1,3,2,3,4,2,1,3,1,
%T 1,3,2,3,1,1,1,5,2,8,3,1,1,1,1,2,3,5,2,2,1,3,2,1,2,1,1,4,1,2,1,4,1,5,
%U 1,1,2,3,2,3,3,1,1,2,1,2,1,1,1,2,1,3,1,1,4,2,1,5,4,2,1,3,1,2,2,6,4,1,1,1,2
%N a(n) is the depth of the prime tree formed when 4p +- 3 is applied to the n-th prime and repeatedly to any primes generated from the n-th prime via this process.
%C Note all prime trees have a minimum depth of 1, as the starting prime forms the root of the tree.
%H Alois P. Heinz, <a href="/A086320/b086320.txt">Table of n, a(n) for n = 1..65536</a>
%e a(125) = 5 because the 125th prime is 691, which generates further primes through 4 repeated applications of 4p +- 3, giving a prime tree with generations as follows:
%e 1. 691
%e 2. 4 * 691 + 3 = 2767
%e 3. 4 * 2767 + 3 = 11071
%e 4. 4 * 11071 - 3 = 44281
%e 5. 4 * 44281 + 3 = 177127
%p b:= proc(p) option remember;
%p `if`(isprime(p), 1 + max(b(4*p+3), b(4*p-3)), 0)
%p end:
%p a:= n-> b(ithprime(n)):
%p seq(a(n), n=1..120); # _Alois P. Heinz_, Dec 02 2018
%t f[n_] := f[n] = If[PrimeQ[n], 1 + Max[f[4 n - 3], f[4 n + 3]], 0]; f /@ Prime@Range@100 (* _Amiram Eldar_, Dec 02 2018 *)
%o (Python)
%o from functools import cache
%o from sympy import isprime, prime
%o @cache
%o def b(p): return 1 + max(b(4*p+3), b(4*p-3)) if isprime(p) else 0
%o def a(n): return b(prime(n))
%o print([a(n) for n in range(1, 105)]) # _Michael S. Branicky_, Nov 01 2021 after _Alois P. Heinz_
%Y Cf. A086319.
%K nonn
%O 1,1
%A Chuck Seggelin (barkeep(AT)plastereddragon.com), Jul 17 2003
%E Offset corrected by _Alois P. Heinz_, Dec 02 2018