# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a068632 Showing 1-1 of 1 %I A068632 #7 Dec 05 2013 19:55:11 %S A068632 2,9,6,12,8,4,18,14,10,20,24,22,30,32,16,36,44,40,26,28,38,48,34,42, %T A068632 50,46,60,54,56,52,66,62,78,64,72,68,70,86,76,74,96,84,90,82,80,58,92, %U A068632 88,104,102,106,98,100,110,112,120,132,108,140,94,116,114,124,126,128,136 %N A068632 a(1) = 2; a(n+1) = smallest composite number not in the sequence such that the sum of all the terms is prime. %e A068632 a(3) = 6 not 4 as 2 + 9 + 6 = 17 is prime, while 2+9 +4 = 15 is composite. %p A068632 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); %Y A068632 Cf. A068631. %K A068632 easy,nonn %O A068632 0,1 %A A068632 _Amarnath Murthy_, Feb 26 2002 %E A068632 Corrected and extended by _Sascha Kurz_, Mar 26 2002 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE