Skip to main content
added 46 characters in body
Source Link

Swift 2.0, 70 100 98 82 7777 75 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes! Will default to using 64-bit ints.

let n=Int(Process.arguments[1])!;print(n<4||(2...n/2<n).filter{n%$0<1}.count<1)

Swift 2.0, 70 100 98 82 77 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

let n=Int(Process.arguments[1])!;print(n<4||(2...n/2).filter{n%$0<1}.count<1)

Swift 2.0, 70 100 98 82 77 75 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes! Will default to using 64-bit ints.

let n=Int(Process.arguments[1])!;print(n<4||(2..<n).filter{n%$0<1}.count<1)
added 46 characters in body
Source Link

Swift 2.0, 70 100 98 8282 77 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

let n=Int(Process.arguments[1])!;print(n<4 ?true:n<4||(2...n/2).filter{n%$0<1}.count<1)

Swift 2.0, 70 100 98 82 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

let n=Int(Process.arguments[1])!;print(n<4 ?true:(2...n/2).filter{n%$0<1}.count<1)

Swift 2.0, 70 100 98 82 77 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

let n=Int(Process.arguments[1])!;print(n<4||(2...n/2).filter{n%$0<1}.count<1)
added 46 characters in body
Source Link

Swift 2.0, 7070 100 98 82 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

funclet pn=Int(n:IntProcess.arguments[1])->Bool{return !;print(n<4 ?true:(2...n/2).filter{n%$0<1}.count<1})

Swift 2.0, 70 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

func p(n:Int)->Bool{return n<4 ?true:(2...n/2).filter{n%$0<1}.count<1}

Swift 2.0, 70 100 98 82 bytes

A simple trial division loop, divided by 2 instead of sqrt() as it takes less bytes!

let n=Int(Process.arguments[1])!;print(n<4 ?true:(2...n/2).filter{n%$0<1}.count<1)
Source Link
Loading