<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Multiples of 3 and 5
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
Step1:  Even Fibonacci numbers
Problem 2
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be
Step2:  Largest prime factor
Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
Step3:  Largest palindrome product
Problem 4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
Step4:  Smallest multiple
Problem 5
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?
Step5:  Sum square difference
Problem 6
The sum of the squares of the first ten natural numbers is,
$12+2^2+...+10^2=385$
The square of the sum of the first ten natural numbers is,
$(1+2+...+10)^2=55^2=3025$
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is $3025−385=26403025−385=2640$.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
Step6:  10001st prime
Problem 7
By listing the first six prime numbers
Step7:  Largest product in a series
Problem 8
Find the greatest product of five consecutive digits in the 1000-digit number.
Step8:  Special Pythagorean triplet
Problem 9
A Pythagorean triplet is a set of three natural numbers, a<b<ca<b<c, for which,
$a^2+b^2=c^2$
For example, $3^2+4^2=9+16=25=5^2$.
There exists exactly one Pythagorean triplet for which $a+b+c=1000$. Find the product $abc$.
Step9:  Summation of primes
Problem 10
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
<ASSISTANT_TASK:>
Python Code:
from euler import Seq, timer
def p001():
    return (
        range(1000)
        >> Seq.filter(lambda n: (n%3==0) | (n%5==0))
        >> Seq.sum)
timer(p001)
Explanation: Multiples of 3 and 5
Problem 1
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
End of explanation
from euler import Seq, timer
def p002():
    return (
        Seq.unfold(lambda (a,b): (b, (b, b+a)), (0,1))
        >> Seq.filter(lambda n: n%2==0)
        >> Seq.takeWhile(lambda n: n<4000000)
        >> Seq.sum)    
    
timer(p002)
Explanation: Even Fibonacci numbers
Problem 2
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
End of explanation
from euler import Seq, FactorInteger, fst, timer
def p003():
    return FactorInteger(600851475143) >> Seq.map(fst) >> Seq.max
timer(p003)
Explanation: Largest prime factor
Problem 3
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143 ?
End of explanation
from euler import Seq, timer
def p004():
    return (
        range(100, 1000)
        >> Seq.collect(lambda a: range(a, 1000)
                                 >> Seq.filter(lambda b: str(a*b)[::-1] == str(a*b))
                                 >> Seq.map(lambda b: a*b))
        >> Seq.max)
timer(p004)
from euler import Seq, timer
def p004():
    return (
        [a*b for a in range(100, 1000)
         for b in range(a, 1000)
         if str(a*b)[::-1] == str(a*b)]
        >> Seq.max)
timer(p004)
Explanation: Largest palindrome product
Problem 4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
End of explanation
from euler import Seq, LCM, timer
def p005():
    return (range(1,21) >> Seq.reduce(LCM))
timer(p005)
Explanation: Smallest multiple
Problem 5
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?
End of explanation
from euler import timer, Seq
def p006():
    return (range(101) >> Seq.sum) ** 2 - (range(101) >> Seq.sumBy(lambda i: i**2))
timer(p006)
from euler import timer
def p006():
    return sum(range(101)) ** 2 - sum(i ** 2 for i in range(101))
timer(p006)
Explanation: Sum square difference
Problem 6
The sum of the squares of the first ten natural numbers is,
$12+2^2+...+10^2=385$
The square of the sum of the first ten natural numbers is,
$(1+2+...+10)^2=55^2=3025$
Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is $3025−385=26403025−385=2640$.
Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
End of explanation
from euler import prime, timer
def p007():
    return prime(10000)
timer(p007)
Explanation: 10001st prime
Problem 7
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
End of explanation
from euler import Seq, timer
def p007():
    return (
        "".join(open('data/p008.txt').read().splitlines())
        >> Seq.window(5)
        >> Seq.map(lambda s: s >> Seq.map(int) >> Seq.product)
        >> Seq.max)
timer(p007)
Explanation: Largest product in a series
Problem 8
Find the greatest product of five consecutive digits in the 1000-digit number.
End of explanation
from euler import timer, Seq
def p009():
    return(
        range(1,999)
        >> Seq.collect(lambda a: range(a, 1000-a) 
                                 >> Seq.filter(lambda b: (a**2 + b**2 == (1000-a-b)**2)) 
                                 >> Seq.map(lambda b: a*b*(1000-a-b)))
        >> Seq.head)
timer(p009)
def p009():
    return (
        [a*b*(1000-a-b)
         for a in range(1,999) 
         for b in range(a, 1000-a)
         if (a ** 2 + b ** 2 == (1000-a-b) ** 2)][0])
timer(p009)
Explanation: Special Pythagorean triplet
Problem 9
A Pythagorean triplet is a set of three natural numbers, a<b<ca<b<c, for which,
$a^2+b^2=c^2$
For example, $3^2+4^2=9+16=25=5^2$.
There exists exactly one Pythagorean triplet for which $a+b+c=1000$. Find the product $abc$.
End of explanation
from euler import Seq, primes, timer
def p010():
    return (
        primes()
        >> Seq.takeWhile(lambda n: n<2000000)
        >> Seq.sum)
timer(p010)
Explanation: Summation of primes
Problem 10
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
End of explanation
<END_TASK>