login
A068632
a(1) = 2; a(n+1) = smallest composite number not in the sequence such that the sum of all the terms is prime.
1
2, 9, 6, 12, 8, 4, 18, 14, 10, 20, 24, 22, 30, 32, 16, 36, 44, 40, 26, 28, 38, 48, 34, 42, 50, 46, 60, 54, 56, 52, 66, 62, 78, 64, 72, 68, 70, 86, 76, 74, 96, 84, 90, 82, 80, 58, 92, 88, 104, 102, 106, 98, 100, 110, 112, 120, 132, 108, 140, 94, 116, 114, 124, 126, 128, 136
OFFSET
0,1
EXAMPLE
a(3) = 6 not 4 as 2 + 9 + 6 = 17 is prime, while 2+9 +4 = 15 is composite.
MAPLE
a[1] := 2:for i from 2 to 120 do j := 2:while(true)do j := j+1: if((not isprime(j)) and (not (j=a[i-1]))) then bo := true: for h from 1 to i-1 do if(a[h]=j) then bo := false end if:end do: if(isprime(sum(a[k], k=1..i-1)+j) and bo=true) then a[i] := j:break:end if:end if:end do:end do:seq(a[k], k=1..120);
CROSSREFS
Cf. A068631.
Sequence in context: A011247 A201736 A377696 * A320037 A122664 A318649
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, Feb 26 2002
EXTENSIONS
Corrected and extended by Sascha Kurz, Mar 26 2002
STATUS
approved