|
|
A175458
|
|
a(0)=0. a(n) = a(n-1) - n, if a(n-1) - n = a (positive) prime. Otherwise a(n) = a(n-1) + n.
|
|
1
|
|
|
0, 1, 3, 6, 2, 7, 13, 20, 28, 19, 29, 40, 52, 65, 79, 94, 110, 127, 109, 128, 148, 127, 149, 172, 196, 221, 247, 274, 302, 331, 361, 392, 424, 457, 491, 526, 562, 599, 637, 676, 716, 757, 799, 842, 886, 931, 977, 1024, 1072, 1121, 1171, 1222, 1274, 1327, 1381
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Terms a(1) through a(15) match the first 15 terms of A098141.
|
|
LINKS
|
|
|
FORMULA
|
The only decreases are for n = 4, 9, 18, and 21. Thereafter, a(n) = n*(n+1)/2-104, so a(n)-(n+1) = n*(n-1)/2-105 = (n-15)*(n+14)/2, which is not prime (for n > 17). - Franklin T. Adams-Watters, May 25 2010
|
|
MAPLE
|
A175458 := proc(n) option remember; if n =0 then 0; else if isprime( procname(n-1)-n) then procname(n-1)-n; else procname(n-1)+n ; end if; end if; end proc: seq(A175458(n), n=0..120) ; # R. J. Mathar, May 28 2010
|
|
PROG
|
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|