First 9 prime Fibonacci number: Difference between revisions

Content added Content deleted
(Add Draco)
(Add CLU)
Line 274: Line 274:
2 3 5 13 89 233 1597 28657 514229 433494437 2971215073 99194853094755497
2 3 5 13 89 233 1597 28657 514229 433494437 2971215073 99194853094755497
</pre>
</pre>

=={{header|CLU}}==
<lang clu>fibonacci = iter () yields (int)
a: int := 1
b: int := 1
while true do
yield(a)
a, b := b, a+b
end
end fibonacci

prime = proc (n: int) returns (bool)
if n <= 4 then return(n=2 cor n=3) end
if n//2=0 cor n//3=0 then return(false) end
d: int := 5
while d*d <= n do
if n//d=0 then return(false) end
d := d+2
if n//d=0 then return(false) end
d := d+4
end
return(true)
end prime

start_up = proc ()
po: stream := stream$primary_output()
seen: int := 0
for n: int in fibonacci() do
if seen=9 then break end
if prime(n) then
stream$putl(po, int$unparse(n))
seen := seen+1
end
end
end start_up</lang>
{{out}}
<pre>2
3
5
13
89
233
1597
28657
514229</pre>


=={{header|Draco}}==
=={{header|Draco}}==