Created
February 27, 2017 21:18
-
-
Save seth10/132c17ac447595886a79f6522d4ead8a to your computer and use it in GitHub Desktop.
Created October 4, 2015 at 12:05 AM
This file contains 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
//: Playground - noun: a place where people can play | |
var n = 61 | |
var isPrime = true | |
//for var factor = 2; factor < n; factor++ { | |
for factor in stride(from: 2, to: n/2, by: 2) { | |
if n % factor == 0 { | |
isPrime = false | |
break | |
} | |
} | |
isPrime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment