Skip to content

Instantly share code, notes, and snippets.

@navid-kalaei
Created March 17, 2019 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navid-kalaei/3f037e368d00a482fcb2e682eb5e4268 to your computer and use it in GitHub Desktop.
Save navid-kalaei/3f037e368d00a482fcb2e682eb5e4268 to your computer and use it in GitHub Desktop.
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
val appName = "Fibonacci 1"
val conf = new SparkConf()
conf.setAppName(appName)
val sparkCxt = new SparkContext(conf)
var seed1:BigInt = 1
var seed2:BigInt = 1
val limit = 100
var resultStr = seed1 + " " + seed2 + " "
for( i <- 1 to limit ){
val fib:BigInt = seed1 + seed2
resultStr += fib.toString + " "
seed1 = seed2
seed2 = fib
}
println()
println( "Result : " + resultStr )
println()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment