Task

Considering in order of length, n, all sequences of consecutive
primes, p, from 2 onwards, where p < 1000 and n>0, select those
sequences whose sum is prime, and for these display the length of the
sequence, the last item in the sequence, and the sum.




func IsPrime(N);        \Return 'true' if N is a prime number
int  N, I;
[if N <= 1 then return false;
for I:= 2 to sqrt(N) do
    if rem(N/I) = 0 then return false;
return true;
];
 
int Count, N, Sum, Prime;
[Text(0, "Prime Prime
count   sum
");
Count:= 0;  N:= 0;  Sum:= 0;
for Prime:= 2 to 1000-1 do
    if IsPrime(Prime) then
        [N:= N+1;
        Sum:= Sum + Prime;
        if IsPrime(Sum) then
            [Count:= Count+1;
            IntOut(0, N);
            ChOut(0, 9\tab\);
            IntOut(0, Sum);
            CrLf(0);
            ];
        ];
IntOut(0, Count);
Text(0, " prime sums of primes found below 1000.
");
]