mirror of
https://github.com/jlengrand/project_euler.git
synced 2026-03-10 00:31:21 +00:00
Solves problem 4
Creates templates for code Initiates problem 5
This commit is contained in:
18
e.py
Executable file
18
e.py
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
#---
|
||||
Julien Lengrand-Lambert
|
||||
Created on : Wed Jan 11 14:42:54 CET 2012
|
||||
|
||||
DESCRIPTION : Solves problem of Project Euler
|
||||
#---
|
||||
"""
|
||||
def largest():
|
||||
"""
|
||||
Returns
|
||||
"""
|
||||
|
||||
return 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "Answer : %d " % (largest())
|
||||
20
e_4.py
20
e_4.py
@@ -10,10 +10,26 @@
|
||||
Find the largest palindrome made from the product of two 3-digit numbers.
|
||||
#---
|
||||
"""
|
||||
def prod_palindrom(value):
|
||||
def largest_palindrom():
|
||||
"""
|
||||
Returns the largest palindrom made from the product of two 3-digits number
|
||||
"""
|
||||
return 1
|
||||
three_digits = range(100, 1000)
|
||||
largest = 0
|
||||
|
||||
for digit_1 in three_digits:
|
||||
for digit_2 in three_digits:
|
||||
val = digit_1 * digit_2
|
||||
if is_palindrom(val):
|
||||
if largest < val:
|
||||
largest = val
|
||||
return largest
|
||||
|
||||
def is_palindrom(number):
|
||||
"""
|
||||
returns True if a number is a palindrom, False otherwise
|
||||
"""
|
||||
return str(number)[::-1] == str(number)
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "Answer : %d " % (largest_palindrom())
|
||||
|
||||
22
e_5.py
Executable file
22
e_5.py
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
#---
|
||||
Julien Lengrand-Lambert
|
||||
Created on : Wed Jan 11 14:42:54 CET 2012
|
||||
|
||||
DESCRIPTION : Solves problem 5 of Project Euler
|
||||
2520 is the smallest number that can be divided by each of the numbers from 1
|
||||
to 10 without any remainder.
|
||||
What is the smallest positive number that is evenly divisible by all of the
|
||||
numbers from 1 to 20?
|
||||
#---
|
||||
"""
|
||||
def divisible_by_all():
|
||||
"""
|
||||
Returns the smallest number divisible by 1 to 20
|
||||
"""
|
||||
|
||||
return 1
|
||||
|
||||
if __name__ == '__main__':
|
||||
print "Answer : %d " % (divisible_by_all())
|
||||
Reference in New Issue
Block a user