First 9 prime Fibonacci number

From Rosetta Code
Revision as of 00:58, 20 January 2022 by CalmoSoft (talk | contribs) (Created page with "{{Draft task}} ;Task: <br>Show on this page the first 9 Fibonacci number. =={{header|Ring}}== <lang ring> load "stdlib.ring" see "working..." + nl num = 0 see "The firts 9...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
First 9 prime Fibonacci number is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
Task


Show on this page the first 9 Fibonacci number.

Ring

<lang ring> load "stdlib.ring" see "working..." + nl num = 0

see "The firts 9 Prime Fibonacci numbers: " + nl for n = 1 to 1000000

    x = fib(n)
    if isprime(x)
       num++
       if num< 10
          see  "" + x + "  "
       else
          exit
       ok
    ok

next

see "done..." + nl

func fib nr

      if nr = 0 return 0 ok
      if nr = 1 return 1 ok 
      if nr > 1 return fib(nr-1) + fib(nr-2) ok

</lang>

Output:
working...
Prime Fibonacci numbers: 
2  3  5  13  89  233  1597  28657  514229  
done...