OFFSET
0,3
COMMENTS
Terms a(1) through a(15) match the first 15 terms of A098141.
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
(PARI) r=0; vector(60, n, r=if(isprime(r-n), r-n, r+n)) \\ Franklin T. Adams-Watters, May 25 2010
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, May 20 2010
EXTENSIONS
More terms from Franklin T. Adams-Watters and R. J. Mathar, May 25 2010
STATUS
approved