Advertisement
Guest User

Untitled

a guest
Dec 4th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.50 KB | None | 0 0
  1. class Luke4 {
  2.     static private var list = [Int]();
  3.     static private var counter = 0;
  4.    
  5.     static private func isSpecial(n: Int) -> Bool {
  6.         return n % 7 == 0 || String(n).contains("7");
  7.     }
  8.    
  9.     static func solve() {
  10.        
  11.         for n in 1...1337 {
  12.             if (isSpecial(n: n)) {
  13.                 list.append(list[counter]);
  14.                 counter += 1
  15.             } else {
  16.                 list.append(n)
  17.             }
  18.         }
  19.         print(list[1336])
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement