Questions tagged [project-euler]

Project Euler is a series of challenging mathematical/computer programming problems. Please see the site and rules before posting.

(copied from Project Euler site)

Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems.

The motivation for starting Project Euler, and its continuation, is to provide a platform for the inquiring mind to delve into unfamiliar areas and learn new concepts in a fun and recreational context.

Before asking anything about problems in Project Euler, read this question in the meta and this thread in Project Euler forum. Most important things are:

  • Project Euler does not want their participants asking elsewhere, they want them to experiment, solve easier sub-problems, etc.

  • They do not want answers, or parts of answers, publicly visible.

174 questions
47
votes
4 answers

Find the sum of all the multiples of 3 or 5 below 1000

How to solve this problem, I can not figure it out: 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.
Sarfraz
  • 615
  • 1
  • 7
  • 8
44
votes
7 answers

Project Euler, Problem #25

Problem #25 from Project Euler asks: What is the first term in the Fibonacci sequence to contain 1000 digits? The brute force way of solving this is by simply telling the computer to generate Fibonacci numbers until it finds the first one that has…
Paul Manta
  • 3,405
  • 4
  • 33
  • 48
21
votes
3 answers

Are there any mathematics "problem websites" similar to Project Euler?

Are there any mathematics websites similar to Projet Euler, a website which hosts math-heavy programming questions, many of which can be solved with a pen and paper? I've become almost addicted to Project Euler's progress tracking system, and I also…
user168210
15
votes
1 answer

How to find the smallest number with just $0$ and $1$ which is divided by a given number?

Every positive integer divide some number whose representation (base $10$) contains only zeroes and ones. One can easily prove that using pigeonhole principle. Some examples: 2 -> 10 3 -> 111 4 -> 100 ... But how to find the smallest answer? Is…
Sayakiss
  • 395
  • 4
  • 18
14
votes
4 answers

Find the sum of the digits in the number 100!

I am working on a Project Euler problem http://projecteuler.net/problem=20. $n!$ means $n(n - 1)\dots...3.2. 1.$ For example, $10!$ $=$ $10$ $9$ $...$ $3$ $2$ $1$ $=$ $3628800$, and the sum of the digits in the number $10!$ is $3 + 6 + 2 +…
Grady Player
  • 285
  • 1
  • 2
  • 13
14
votes
3 answers

Largest prime factor of 600851475143

I'm trying to use a program to find the largest prime factor of 600851475143. This is for Project Euler here: http://projecteuler.net/problem=3 I first attempted this with the code that goes through every number up to 600851475143, tests its…
12
votes
1 answer

Comparing powers without logarithms

Related to this question and this Project Euler problem (Problem 99), I came up with a recursive algorithm for comparing two numbers of the form $x^y$ (with $x>1$ and $y\ge 0$) without explicit use of logarithms. To compare $x_1^{y_1}$ or…
mjqxxxx
  • 37,360
  • 2
  • 50
  • 99
12
votes
3 answers

Finding prime factors by taking the square root

I'm trying to solve the third Project Euler problem and I'd like a little help understanding a mathematical concept underlying my tentative solution. The question reads: The prime factors of 13195 are 5, 7, 13, and 29. What is the largest prime…
user153085
11
votes
2 answers

How many integer solutions to a diophantine equation

Starting with the equation: $\frac{1}{a}+\frac{1}{b}=\frac{p}{10^n}$, I reached the equation: $10^{n-log(p)} = \frac{ab}{a+b}$. Now given the positive integer $n$, for what integer values of $p$ would the value of: $10^{n-log(p)}$, be…
10
votes
5 answers

Closed form for the sum of even fibonacci numbers?

I recently took a look a project euler, and I am trying to think of a smart way to do number 2. I looked at the sequence, and I saw that the question is basically asking for $$ \sum_{i=1}^n F_{3i} $$ For whatever n is gives me the nth even under a…
Broseph
  • 350
  • 1
  • 14
9
votes
3 answers

Amount of numbers not divisible by 7 in Pascals Triangle without iteration

For project Euler 148 problem, I want to get the amount of numbers in Pascals Triangle that are not divisible by 7 in row 0 to n where n is $10^9$. Find the number of entries which are not divisible by 7 in the first one billion (109) rows of…
Max
  • 2,115
  • 6
  • 17
  • 34
9
votes
4 answers

Find the largest prime factor

I just "solved" the third Project Euler problem: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? With this on Mathematica: Select[Divisors[600851475143], PrimeQ] It will first give me…
Red Banana
  • 22,266
  • 17
  • 83
  • 172
9
votes
4 answers

The longest sum of consecutive primes that add to a prime less than 1,000,000

In Project Euler problem $50,$ the goal is to find the longest sum of consecutive primes that add to a prime less than $1,000,000. $ I have an efficient algorithm to generate a set of primes between $0$ and $N.$ My first algorithm to try this was…
Kylar
  • 248
  • 3
  • 10
8
votes
4 answers

HINT for summing digits of a large power

I recently started working through the Project Euler challenges, but I've got stuck on #16 (http://projecteuler.net/problem=16) $2^{15} = 32768$ and the sum of its digits is $3 + 2 + 7 + 6 + 8 = 26$. What is the sum of the digits of the number…
8
votes
3 answers

Why is the one quadratic polynomial a perfect square more often than the other?

I was solving problem 137 of Project Euler, which led me to find $n$ such that $5n^2+2n+1$ is a perfect square. But such numbers are very rare (the 13th is around 3 billions) so after decomposing into $(n+1)^2 + (2n)^2 = m^2$ and looking for…
1
2 3
11 12