Skip to content

Commit

Permalink
tabs->spaces and 14
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Tribone committed Dec 9, 2012
1 parent f44b817 commit 1b297d7
Show file tree
Hide file tree
Showing 14 changed files with 320 additions and 265 deletions.
8 changes: 4 additions & 4 deletions 001/1.py
Expand Up @@ -6,10 +6,10 @@
count = 0

for x in range(0, 1000):
if x % 3 == 0:
count += x
elif x % 5 == 0:
count += x
if x % 3 == 0:
count += x
elif x % 5 == 0:
count += x

print count

10 changes: 5 additions & 5 deletions 002/2.py
Expand Up @@ -10,11 +10,11 @@
sum = 0

while num2 < 4000000:
temp = num2
num2 = num1 + num2
num1 = temp
if num2 % 2 == 0:
sum += num2
temp = num2
num2 = num1 + num2
num1 = temp
if num2 % 2 == 0:
sum += num2

print sum

24 changes: 12 additions & 12 deletions 003/3.py
Expand Up @@ -4,20 +4,20 @@
"""

def isprime(n):
n = abs(int(n))
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
return False
return True
n = abs(int(n))
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
return False
return True

n = 600851475143

for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
if isprime(x) is True:
print x
if n % x == 0:
if isprime(x) is True:
print x

18 changes: 9 additions & 9 deletions 004/4.py
Expand Up @@ -4,14 +4,14 @@
"""

def ispal(n):
s = str(n)
l = len(s)
for x in range(0, l):
if s[x] != s[l - x - 1]:
return False
return True
s = str(n)
l = len(s)
for x in range(0, l):
if s[x] != s[l - x - 1]:
return False
return True

for x in reversed(range(900, 999)):
for y in reversed(range(900, 999)):
if ispal(x * y):
print x * y
for y in reversed(range(900, 999)):
if ispal(x * y):
print x * y
84 changes: 42 additions & 42 deletions 005/5.py
Expand Up @@ -6,46 +6,46 @@
i = 2520

while True:
if i % 20 != 0:
pass
elif i % 19 != 0:
pass
elif i % 18 != 0:
pass
elif i % 17 != 0:
pass
elif i % 16 != 0:
pass
elif i % 15 != 0:
pass
elif i % 14 != 0:
pass
elif i % 13 != 0:
pass
elif i % 12 != 0:
pass
elif i % 11 != 0:
pass
elif i % 10 != 0:
pass
elif i % 9 != 0:
pass
elif i % 8 != 0:
pass
elif i % 7 != 0:
pass
elif i % 6 != 0:
pass
elif i % 5 != 0:
pass
elif i % 4 != 0:
pass
elif i % 3 != 0:
pass
elif i % 2 != 0:
pass
else:
print i
break
i += 2520
if i % 20 != 0:
pass
elif i % 19 != 0:
pass
elif i % 18 != 0:
pass
elif i % 17 != 0:
pass
elif i % 16 != 0:
pass
elif i % 15 != 0:
pass
elif i % 14 != 0:
pass
elif i % 13 != 0:
pass
elif i % 12 != 0:
pass
elif i % 11 != 0:
pass
elif i % 10 != 0:
pass
elif i % 9 != 0:
pass
elif i % 8 != 0:
pass
elif i % 7 != 0:
pass
elif i % 6 != 0:
pass
elif i % 5 != 0:
pass
elif i % 4 != 0:
pass
elif i % 3 != 0:
pass
elif i % 2 != 0:
pass
else:
print i
break
i += 2520

4 changes: 2 additions & 2 deletions 006/6.py
Expand Up @@ -13,10 +13,10 @@
sqSum = 0

for x in range(1, 101):
sumSq += x**2
sumSq += x**2

for x in range(1, 101):
sqSum += x
sqSum += x

sqSum = sqSum**2

Expand Down
24 changes: 12 additions & 12 deletions 007/7.py
Expand Up @@ -4,23 +4,23 @@
"""

def isprime(n):
n = abs(int(n))
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
return False
return True
n = abs(int(n))
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
return False
return True

count = 1
num = 1

while count < 10001:
num += 2
if isprime(num) is True:
count += 1
num += 2
if isprime(num) is True:
count += 1

print num

6 changes: 3 additions & 3 deletions 008/8.py
Expand Up @@ -26,8 +26,8 @@
max = 0

for x in range(0, len(num) - 4):
temp = int(num[x]) * int(num[x + 1]) * int(num[x + 2]) * int(num[x + 3]) * int(num[x + 4])
if temp > max:
max = temp
temp = int(num[x]) * int(num[x + 1]) * int(num[x + 2]) * int(num[x + 3]) * int(num[x + 4])
if temp > max:
max = temp

print max
14 changes: 7 additions & 7 deletions 009/9.py
Expand Up @@ -8,11 +8,11 @@
"""

for a in range(1, 500):
for b in range(1, 500):
c = (a**2 + b**2)**0.5
if a + b + c != 1000:
continue
else:
print int(a * b * c)
exit()
for b in range(1, 500):
c = (a**2 + b**2)**0.5
if a + b + c != 1000:
continue
else:
print int(a * b * c)
exit()

22 changes: 11 additions & 11 deletions 010/10.py
Expand Up @@ -4,21 +4,21 @@
"""

def isprime(n):
n = abs(int(n))
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
return False
return True
n = abs(int(n))
if n == 2:
return True
if not n & 1:
return False
for x in range(3, int(n**0.5+1), 2):
if n % x == 0:
return False
return True

sum = 2

for x in range(3, 2000000, 2):
if isprime(x) is True:
sum += x
if isprime(x) is True:
sum += x

print sum

0 comments on commit 1b297d7

Please sign in to comment.