login
A103825
Choose a(n) to be the smallest number not yet used such that: a(1) = 1, a(2n) = composite, a(2n+1) = prime and partial sums are alternately prime or composite.
7
1, 4, 3, 9, 5, 15, 2, 8, 7, 25, 11, 49, 13, 21, 17, 33, 19, 27, 23, 39, 29, 119, 31, 77, 37, 35, 41, 51, 43, 45, 47, 55, 53, 57, 59, 91, 61, 65, 67, 87, 71, 69, 73, 93, 79, 85, 83, 95, 89, 63, 97, 81, 101, 99, 103, 75, 107, 105, 109, 141, 113, 115, 127, 125, 131, 111, 137
OFFSET
1,2
LINKS
MAPLE
N:= 1000: # for terms before the first term > N
Avail:= [$2..N]:
A[1]:= 1: T:= 1:
for n from 2 while assigned(A[n-1]) do
for j from 1 to N+1-n do
x:= Avail[j];
if (n::even and isprime(x+T) and not isprime(x)) or
(n::odd and isprime(x) and not isprime(x+T)) then
A[n]:= x; T:= T+x;
Avail:= subsop(j=NULL, Avail);
break
fi
od
od:
seq(A[i], i=1..n-2); # Robert Israel, Nov 26 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Ray Chandler Feb 16 2005
EXTENSIONS
Definition corrected by Zak Seidov, Feb 20 2005
STATUS
approved