login
A085401
a(0) = 1; a(n+1) is the smallest positive number (of at most two) such that abs(a(n) - a(n+1)) is the smallest prime not occurring earlier as difference of successive terms and a(n) + a(n+1) is composite.
2
1, 3, 6, 19, 14, 7, 18, 37, 20, 43, 14, 51, 82, 41, 84, 37, 96, 149, 88, 155, 226, 299, 220, 137, 48, 155, 58, 159, 56, 165, 52, 179, 310, 173, 34, 183, 32, 189, 26, 193, 20, 199, 18, 217, 26, 219, 416, 205, 428, 201, 434, 205, 444, 193, 434, 177, 446, 183, 454, 731
OFFSET
0,2
COMMENTS
There are numbers which occur more than once, e.g. a(6) = a(42) = 18, a(8) = a(40) = 20.
Problem: Does every positive integer eventually occur?
EXAMPLE
a(4) = 14; the smallest prime not occurring earlier as difference of successive terms is 7; there are two numbers x such that abs(14 - x) = 7 and 14 + x is composite, namely x = 7 and x = 21. The smaller of these numbers is 7, so a(5) = 7.
a(11) = 51; the smallest prime not occurring earlier as difference of successive terms is 31; there are two numbers x such that abs(51 - x) = 31, namely x = 20 and x = 82 and 51 + 20 = 71 is not composite while 51 + 82 = 133 is composite;
hence a(12) = 82.
PROG
(PARI) {in(n, v)=local(j, s, b); j=1; s=matsize(v)[2]; b=1; while(b&&j<=s, if(n==v[j], b=0, j++)); !b}
{print1(a=1, ", "); v=[]; for(n=1, 60, p=2; t=1; while(t>0, if(in(p, v), p=nextprime(p+1), if(p<a&&!isprime(2*a-p), t=0; b=a-p, if(!isprime(2*a+p), t=0; b=a+p, p=nextprime(p+1))))); v=concat(v, p); print1(a=b, ", "))}
CROSSREFS
Sequence in context: A135504 A307334 A057268 * A085061 A294570 A306968
KEYWORD
nonn
AUTHOR
Klaus Brockhaus, Jun 28 2003
STATUS
approved