Skip to content

Commit

Permalink
problem 28
Browse files Browse the repository at this point in the history
  • Loading branch information
rcuhljr committed Jan 24, 2012
1 parent 125f43b commit 2d7e380
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions prob28.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import math
import cProfile

def solve(side):
max = side**2
sum = 1
current = 1
step = 0
offset = 0
while current < max:
if step == 0:
offset += 2
step += 1
if step == 4:
step = 0
current += offset
sum += current
print sum



print cProfile.run('solve(1001)')

#brute force, go!

0 comments on commit 2d7e380

Please sign in to comment.