Created
March 17, 2019 19:40
-
-
Save navid-kalaei/3f037e368d00a482fcb2e682eb5e4268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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