login
A086320
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.
1
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, 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, 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
OFFSET
1,1
COMMENTS
Note all prime trees have a minimum depth of 1, as the starting prime forms the root of the tree.
LINKS
EXAMPLE
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:
1. 691
2. 4 * 691 + 3 = 2767
3. 4 * 2767 + 3 = 11071
4. 4 * 11071 - 3 = 44281
5. 4 * 44281 + 3 = 177127
MAPLE
b:= proc(p) option remember;
`if`(isprime(p), 1 + max(b(4*p+3), b(4*p-3)), 0)
end:
a:= n-> b(ithprime(n)):
seq(a(n), n=1..120); # Alois P. Heinz, Dec 02 2018
MATHEMATICA
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 *)
PROG
(Python)
from functools import cache
from sympy import isprime, prime
@cache
def b(p): return 1 + max(b(4*p+3), b(4*p-3)) if isprime(p) else 0
def a(n): return b(prime(n))
print([a(n) for n in range(1, 105)]) # Michael S. Branicky, Nov 01 2021 after Alois P. Heinz
CROSSREFS
Cf. A086319.
Sequence in context: A110305 A010199 A010200 * A185540 A095193 A374332
KEYWORD
nonn
AUTHOR
Chuck Seggelin (barkeep(AT)plastereddragon.com), Jul 17 2003
EXTENSIONS
Offset corrected by Alois P. Heinz, Dec 02 2018
STATUS
approved