Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projecteuler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
projecteuler
Commits
4540b70b
Commit
4540b70b
authored
Jan 06, 2012
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
41: Moved executed code to 'main' section.
parent
f0dab743
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
problem41.py
problem41.py
+10
-9
No files found.
problem41.py
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
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
print
m
print
m
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment