First 9 prime Fibonacci number: Difference between revisions
Content added Content deleted
(Added Go) |
Not a robot (talk | contribs) (Add Draco) |
||
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|Draco}}== |
|||
<lang draco>proc nonrec prime(ulong n) bool: |
|||
bool comp; |
|||
ulong d; |
|||
if n <= 4 then n=2 or n=3 |
|||
elif n&1 = 0 or n%3 = 0 then false |
|||
else |
|||
d := 5; |
|||
comp := false; |
|||
while not comp and d*d <= n do |
|||
if n%d = 0 then comp := true fi; |
|||
d := d + 2; |
|||
if n%d = 0 then comp := true fi; |
|||
d := d + 4 |
|||
od; |
|||
not comp |
|||
fi |
|||
corp |
|||
proc nonrec main() void: |
|||
ulong a, b, c; |
|||
byte n; |
|||
a := 1; |
|||
b := 1; |
|||
n := 0; |
|||
while n < 9 do |
|||
if prime(a) then |
|||
writeln(a); |
|||
n := n + 1 |
|||
fi; |
|||
c := a + b; |
|||
a := b; |
|||
b := c |
|||
od |
|||
corp</lang> |
|||
{{out}} |
|||
<pre>2 |
|||
3 |
|||
5 |
|||
13 |
|||
89 |
|||
233 |
|||
1597 |
|||
28657 |
|||
514229</pre> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |