[go: up one dir, main page]

login
A367188
a(1) = 1, thereafter a(n) = a(n-1) - A007504(n-1) if positive and novel, else a(n-1) + A007504(n-1).
1
1, 3, 8, 18, 35, 7, 48, 106, 29, 129, 258, 98, 295, 57, 338, 10, 391, 831, 330, 898, 259, 971, 180, 1054, 91, 1151, 2312, 1048, 2419, 939, 2532, 812, 2663, 675, 2802, 526, 2953, 369, 3116, 202, 3289, 23, 3470, 7108, 3277, 7305, 3078, 7516, 2855, 7743, 2626, 7976
OFFSET
1,2
COMMENTS
A variation on Cald's sequence A006509.
LINKS
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
EXTENSIONS
More terms from Michael De Vlieger, Nov 10 2023
STATUS
approved