Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
projecteuler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Taddeüs Kroes
projecteuler
Commits
acdb419a
Commit
acdb419a
authored
12 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Solved 50
parent
1a8b5ee2
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
problem50.py
+23
-0
23 additions, 0 deletions
problem50.py
with
23 additions
and
0 deletions
problem50.py
0 → 100644
+
23
−
0
View file @
acdb419a
#!/usr/bin/env python
from
math
import
sqrt
from
utils
import
primes_until
def
maxprime
(
n
):
primes
=
list
(
primes_until
(
n
))
maxp
=
maxlen
=
2
for
start
in
xrange
(
len
(
primes
)):
for
end
in
xrange
(
start
+
maxlen
+
1
,
start
+
800
):
if
end
-
start
>=
maxlen
:
conseq
=
primes
[
start
:
end
]
s
=
sum
(
conseq
)
if
len
(
conseq
)
>
1
and
s
in
primes
[
start
:]:
maxlen
=
end
-
start
maxp
=
s
print
maxp
#print '%s = %d' % (' + '.join(map(str, primes[start:end])), s)
return
maxp
print
maxprime
(
1000000
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment