First 9 prime Fibonacci number: Difference between revisions
Content added Content deleted
(→OCaml: add) |
Drkameleon (talk | contribs) (added Arturo) |
||
Line 167: | Line 167: | ||
2 3 5 13 89 233 1597 28657 514229 |
2 3 5 13 89 233 1597 28657 514229 |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<syntaxhighlight lang="arturo">fib: $[x][ |
|||
if? x<2 [1] |
|||
else [(fib x-1) + (fib x-2)] |
|||
] |
|||
firstPrimeFibos: select.first:9 2..∞ 'n -> prime? fib n |
|||
loop firstPrimeFibos 'f -> |
|||
print ["F(" ++ (to :string f+1) ++ ") =" fib f]</syntaxhighlight> |
|||
{{out}} |
|||
<pre>F(3) = 2 |
|||
F(4) = 3 |
|||
F(5) = 5 |
|||
F(7) = 13 |
|||
F(11) = 89 |
|||
F(13) = 233 |
|||
F(17) = 1597 |
|||
F(23) = 28657 |
|||
F(29) = 514229</pre> |
|||
=={{header|AWK}}== |
=={{header|AWK}}== |
||
Line 206: | Line 230: | ||
2 3 5 13 89 233 1597 28657 514229 |
2 3 5 13 89 233 1597 28657 514229 |
||
</pre> |
</pre> |
||
=={{header|BASIC}}== |
=={{header|BASIC}}== |