OFFSET
0,6
COMMENTS
After the initial zeros, {a(n)} seems approximately linear on a log scale (not a surprise with the prime number theorem in mind?), a(n-1)/a(n) seems to converge to the golden ratio (A001622), and 1/a(5) + 1/a(6) + ... + 1/a(n) seems to converge to 0.60086367622...
MAPLE
b:= proc(n, t) option remember; `if`(n<3, n+1, (h-> `if`(t=1,
prevprime(h), nextprime(h)))(t+b(n-1, t)+b(n-2, t)))
end:
a:= n-> b(n, -1)-b(n, 1):
seq(a(n), n=1..50); # Alois P. Heinz, May 12 2023
MATHEMATICA
b[n_, t_] := b[n, t] = If[n < 3, n+1, Function[h, If[t == 1, NextPrime[h, -1], NextPrime[h]]][t + b[n-1, t] + b[n-2, t]]];
a[n_] := If[n == 0, -1, b[n-1, -1] - b[n-1, 1]];
Table[a[n], {n, 0, 50}] (* Jean-François Alcover, May 19 2024, after Alois P. Heinz *)
CROSSREFS
KEYWORD
sign
AUTHOR
Philip Baciaz, May 07 2023
STATUS
approved