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
    
  
  
    
  | def palindrome(n): | |
| return n == int(str(n)[::-1]) | |
| print max((i * j for i in range(100, 1000) | |
| for j in range(100, 1000) | |
| if palindrome(i * j))) | 
  
    
      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
    
  
  
    
  | def factorise(n): | |
| result = [] | |
| check = 2 | |
| while (check * check <= n): | |
| if n % check == 0: | |
| result.append(check) | |
| n /= check | |
| else: | |
| check += 1 | |
| if n != 1: | 
  
    
      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
    
  
  
    
  | from itertools import takewhile | |
| def fib(): | |
| a, b = 1, 1 | |
| while 1: | |
| yield a | |
| a, b = b, a + b | |
| print sum(n for n in takewhile(lambda f: f < 4000000, fib()) if n % 2 == 0) | 
  
    
      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
    
  
  
    
  | print sum(n for n in range(1000) if n % 3 == 0 or n % 5 == 0) | 
NewerOlder