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
4540b70b
Commit
4540b70b
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
41: Moved executed code to 'main' section.
parent
f0dab743
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
problem41.py
+10
-9
10 additions, 9 deletions
problem41.py
with
10 additions
and
9 deletions
problem41.py
+
10
−
9
View file @
4540b70b
from
itertools
import
permutations
def
is_prime
(
n
):
if
n
==
2
:
return
True
...
...
@@ -13,13 +11,16 @@ def is_prime(n):
return
True
m
=
0
if
__name__
==
'
__main__
'
:
from
itertools
import
permutations
m
=
0
for
i
in
xrange
(
2
,
10
):
for
digits
in
permutations
(
map
(
str
,
range
(
i
,
0
,
-
1
))):
n
=
int
(
''
.
join
(
digits
))
for
i
in
xrange
(
2
,
10
):
for
digits
in
permutations
(
map
(
str
,
range
(
i
,
0
,
-
1
))):
n
=
int
(
''
.
join
(
digits
))
if
n
>
m
and
is_prime
(
n
):
m
=
n
if
n
>
m
and
is_prime
(
n
):
m
=
n
print
m
print
m
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