login
A092951
Beginning with n, add the next number, subtract the previous number, and so on; then a(n) is the largest prime arising in this process, or 0 if no prime is reached in 2n-1 steps: a(n) is the largest occurring prime in the sum n + (n+1) - (n-1) + (n+2) - (n-2) + (n+3) - (n-3) + ... +- 1 occurring at any stage.
1
3, 5, 7, 17, 19, 37, 37, 41, 67, 101, 103, 73, 107, 197, 199, 257, 257, 157, 263, 401, 401, 269, 487, 577, 577, 677, 677, 281, 787, 421, 787, 593, 907, 797, 1091, 1297, 1297, 1301, 1447, 1601, 1601, 1453, 1607, 1609, 1459
OFFSET
1,1
COMMENTS
Conjecture: No term is zero.
EXAMPLE
a(5) = 19: the steps are 5, 5+6, 5+6-4, 5+6-4+7, 5+6-4+7-3, 5+6-4+7-3+8, 5+6-4+7-3+8-2, 5+6-4+7-3+8-2+9, 5+6-4+7-3+8-2+9-1, and the numbers arising are 5, 11, 7, 14, 11, 19, 17, 26, 25; 19 is the largest prime.
PROG
(GAP) A := function ( n ) local m, p, l, u; p := 0; u := n + 1; l := n - 1; m := n; if IsPrime( m ) then p := m; fi; repeat m := m + u; if IsPrime( m ) then p := m; fi; u := u + 1; m := m - l; if m > p and IsPrime( m ) then p := m; fi; l := l - 1; until l = 0; return p; end; # Simon Nickerson (simonn(AT)maths.bham.ac.uk), Jun 29 2005
CROSSREFS
Cf. A092950.
Sequence in context: A085499 A169628 A171254 * A001259 A248370 A087126
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Mar 24 2004
EXTENSIONS
More terms from Simon Nickerson (simonn(AT)maths.bham.ac.uk), Jun 29 2005
STATUS
approved