First 9 prime Fibonacci number: Difference between revisions

Added XPL0 example.
m (→‎{{header|Raku}}: slightly nicer layout)
(Added XPL0 example.)
Line 61:
2 3 5 13 89 233 1597 28657 514229
done...
</pre>
 
=={{header|XPL0}}==
<lang XPL0>func IsPrime(N); \Return 'true' if N is prime
int N, I;
[if N <= 2 then return N = 2;
if (N&1) = 0 then return false;
for I:= 3 to sqrt(N) do
[if rem(N/I) = 0 then return false;
I:= I+1;
];
return true;
];
 
int F, N, N0, C;
[C:= 0; N:= 1; N0:= 1;
loop [F:= N + N0;
if IsPrime(F) then
[IntOut(0, F); ChOut(0, ^ );
C:= C+1;
if C >= 9 then quit;
];
N0:= N;
N:= F;
];
]</lang>
 
{{out}}
<pre>
2 3 5 13 89 233 1597 28657 514229
</pre>
772

edits