Project Euler 132: Determining the first forty prime factors of a very large repunit
Problem Description
A number consisting entirely of ones is called a repunit. We shall define R(k) to be a repunit of length k.
For example, R(10) = 1111111111 = 11×41×271×9091, and the sum of these prime factors is 9414.
Find the sum of the first forty prime factors of R(109).
Analysis
Another quick solution using the modulus power function to find the prime factors of a large repunit, r(109).
Project Euler 132 Solution
Runs < 0.275 seconds in Python 2.7.Use this link to get the Project Euler 132 Solution Python 2.7 source.
Afterthoughts
- Function
is_prime
is listed in Common Functions and Routines for Project Euler - See also, Project Euler 132 Solution:
- Here are the first 40 prime factors: [11, 17, 41, 73, 101, 137, 251, 257, 271, 353, 401, 449, 641, 751, 1201, 1409, 1601, 3541, 4001, 4801, 5051, 9091, 10753, 15361, 16001, 19841, 21001, 21401, 24001, 25601, 27961, 37501, 40961, 43201, 60101, 62501, 69857, 76001, 76801, 160001]
Project Euler 132 Solution last updated
Discussion
No comments yet.