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 hotpo(n): | |
| steps = 0 | |
| while n > 1: | |
| if n % 2 == 0: | |
| n = n / 2 | |
| else: | |
| n = 3 * n + 1 | |
| steps += 1 | |
| return steps | 
  
    
      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
    
  
  
    
  | numbers = ( | |
| 37107287533902102798797998220837590246510135740250, | |
| 46376937677490009712648124896970078050417018260538, | |
| 74324986199524741059474233309513058123726617309629, | |
| 91942213363574161572522430563301811072406154908250, | |
| 23067588207539346171171980310421047513778063246676, | |
| 89261670696623633820136378418383684178734361726757, | |
| 28112879812849979408065481931592621691275889832738, | |
| 44274228917432520321923589422876796487670272189318, | |
| 47451445736001306439091167216856844588711603153276, | 
  
    
      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 count | |
| from itertools import dropwhile | |
| from math import sqrt | |
| def factorise(n): | |
| c = 0 | |
| sr = int(sqrt(n)) | |
| for i in range(1, sr + 1): | |
| if n % i == 0: | |
| c += 2 | 
  
    
      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 operator import mul | |
| ns = [ | |
| [ 8, 2,22,97,38,15, 0,40, 0,75, 4, 5, 7,78,52,12,50,77,91, 8], | |
| [49,49,99,40,17,81,18,57,60,87,17,40,98,43,69,48, 4,56,62, 0], | |
| [81,49,31,73,55,79,14,29,93,71,40,67,53,88,30, 3,49,13,36,65], | |
| [52,70,95,23, 4,60,11,42,69,24,68,56, 1,32,56,71,37, 2,36,91], | |
| [22,31,16,71,51,67,63,89,41,92,36,54,22,40,40,28,66,33,13,80], | |
| [24,47,32,60,99, 3,45, 2,44,75,33,53,78,36,84,20,35,17,12,50], | |
| [32,98,81,28,64,23,67,10,26,38,40,67,59,54,70,66,18,38,64,70], | 
  
    
      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 count | |
| from itertools import dropwhile | |
| from math import sqrt | |
| from operator import mul | |
| def triple(): | |
| for a in range(1, 1000): | |
| for b in range(a + 1, 1000): | |
| c = int(sqrt(a * a + b * b)) | |
| if c * c == a * a + b * b: | 
  
    
      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 count | |
| from itertools import takewhile | |
| def prime(): | |
| primes = [] | |
| for n in count(2): | |
| composite = 0 | |
| for p in primes: | |
| if not n % p: | |
| composite = 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 operator import mul | |
| from itertools import islice | |
| s = '\ | |
| 73167176531330624919225119674426574742355349194934\ | |
| 96983520312774506326239578318016984801869478851843\ | |
| 85861560789112949495459501737958331952853208805511\ | |
| 12540698747158523863050715693290963295227443043557\ | |
| 66896648950445244523161731856403098711121722383113\ | |
| 62229893423380308135336276614282806444486645238749\ | 
  
    
      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 count | |
| from itertools import islice | |
| def prime(): | |
| primes = [] | |
| for n in count(2): | |
| composite = 0 | |
| for p in primes: | |
| if not n % p: | |
| composite = 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
    
  
  
    
  | print sum(range(1, 101)) ** 2 - sum(n * n for n in range(1, 101)) | 
  
    
      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 gcd(i, j): | |
| while j: | |
| i, j = j, i % j | |
| return i | |
| def lcm(i, j): | |
| return i * j / gcd(i, j) | |
| print reduce(lcm, range(1, 21)) |