OFFSET
1,2
COMMENTS
A variation on Cald's sequence A006509.
LINKS
Michael De Vlieger, Table of n, a(n) for n = 1..10000
Michael De Vlieger, Log log scatterplot of a(n), n = 1..2^20.
EXAMPLE
a(1)-A007504(1) = 1-2, negative so a(2) = 1+2 = 3.
a(2)-A007504(2) = 3-5, negative so a(3) = 3+5 = 8.
a(3)-A007504(3) = 8-10, negative so a(4) = 8+10 =18.
a(4)-A007504(4) = 18-17 = 1 (positive but seen before at a(1)), so a(5) = 35.
a(5)-A007504(5) = 35-28 = 7, positive and novel so a(6) = 7.
a(10)-A007504(10) = 129-129 = 0, therefore a(11) = 2*129 = 258.
MATHEMATICA
nn = 120; c[_] := False; a[1] = j = 1; c[1] = True; s = 2;
Do[If[Or[# < 1, c[#]], Set[k, j + s], Set[k, #]] &[j - s];
s += Prime[n];
Set[{a[n], j, c[k]}, {k, k, True}], {n, 2, nn}];
Array[a, nn]] (* Michael De Vlieger, Nov 10 2023 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
David James Sycamore, Nov 10 2023
EXTENSIONS
More terms from Michael De Vlieger, Nov 10 2023
STATUS
approved