A Groovy script to naively calculate the Fibonacci series inspired by the example here.

Note: a version using memoizing will be much more efficient but this illustrates using Java's built-in concurrency primitives from Groovy.

Which produces this:

Calculating Fibonacci sequence in parallel... n=8 => 21 n=9 => 34 n=10 => 55 n=11 => 89 n=12 => 144 n=13 => 233 n=14 => 377 n=15 => 610 n=16 => 987