Last active
February 23, 2016 23:12
-
-
Save andresilva/f5a9c51bbd7e8b19ef6d to your computer and use it in GitHub Desktop.
fizzbuzz sorcery edition
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
val ms = Array("", "Fizz", "Buzz", "FizzBuzz") | |
var acc = 810092048 | |
var c = 0 | |
val N = 50 | |
(1 to N).foreach { i => | |
c = acc & 3 | |
println(if (c > 0) ms(c) else i) | |
acc = acc >> 2 | c << 28 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment