Advertisement
Guest User

Blah

a guest
Mar 29th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.52 KB | None | 0 0
  1. func isPrime (num : AnyObject?) -> Bool
  2. {
  3.    
  4.     if (num is (Int, Int))
  5.     {
  6.         if ((num as! (Int, Int)).0 == 1)
  7.         {
  8.             return true
  9.         }
  10.        
  11.         if ((num as! (Int, Int)).1 % ((num as! (Int, Int))).0 == 0)
  12.         {
  13.             return false
  14.         }
  15.        
  16.     }
  17.    
  18.     if (num is Int)
  19.     {
  20.         return isPrime(num:((num as! Int - 1), num as! Int) as AnyObject?)
  21.     }
  22.    
  23.     return isPrime(num:(((num as! (Int, Int)).0)-1, ((num as! (Int, Int)).1)) as AnyObject)
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement