Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results for euler 2 tagged with
Search options not deleted

Use this tag when the code is a solution to a programming challenge. Always include a sufficient description of the problem to be solved - while a link to the challenge is welcome, the review request needs to be complete when the challenge site is unavailable.

7 votes
Accepted

FORTRAN90 test suite for Project Euler

A given child subprocess could execute all Euler functions or just a subset of them, even just a single function. … If you'd care to keep it vague, maybe define such running times as powers of \$2\$, with the smallest limit being \$2^5\$ seconds. …
J_H's user avatar
  • 35k
4 votes
2 answers
1k views

Calculate the first largest factor of 600851475143

x 5 x 5 or as factors with exponents, 2^2 x 5^2. … My Solution This is my solution for problem 3 of Project Euler using Python: def FLPF(n): '''Find Largest Prime Factor ''' PrimeFactor = 1 i = 2 while i <= n / i: if n % i == 0: …
1 vote
1 answer
103 views

Project Euler 10(Python) | Summation of Primes

This is my Python3 code which solved the 10th problem of Project Euler. … I haven't passed the last 2 time limit test cases. def sieve_of_eratosthenes(n): result = [True] * (n + 1) result[0] = result[1] = False for i in range(2, int(n**0.5)+1): if result[ …
0 votes
3 answers
649 views

Project Euler #12 (Highly divisible triangular numbers) in Python 3.x

I'm a beginner to programming and just started python, I've been trying to work through Project Euler challenges. … I wrote a program to solve Project Euler #12, which asks for the smallest number of the form 1+ 2 + 3 + … + n which has over 500 divisors. …
0 votes
1 answer
2k views

Project Euler Problem #12 - Highly divisible triangular number

Project Euler Problem #12 The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. … regarding long run times (my problem) but I don't understand the explanations so here is my take; def euler_12(num): i = 0 for n in range(1,num): list= [] for j in range(1, n**2) …
6 votes
3 answers
2k views

Finding the first triangle number with over five hundred divisors

Project Euler Problem #12: The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. … total = 0; int sum = overallAdd + i; i++; overallAdd = sum; int sqrtSum = (int)sqrt(sum); for(int c = 1; c <=sqrtSum;c++) { if(sum%c == 0) { total += 2; …
2 votes
2 answers
322 views

Project Euler 378: Count ordered triplets whose triangular numbers have decreasing number of...

Project Euler problem 378 says: Let \$T(n)\$ be the \$n\$th triangle number, so \$T(n) = {n (n+1) \over 2}\$. Let \$\mathit{dT}(n)\$ be the number of divisors of \$T(n)\$. … This is my attempt at solving it: def t(n): tri_num = (n * (n+1))//2 return tri_num #finding nth triangle numbers def dt(n): count = 0 for i in range(1,t(n)+1): if t(n)%i == …
1 vote
0 answers
65 views

Euler Project Problem #3 Optimization Needed

My Code: function isPrime(x){ if(x % 2 == 0 && x != 2){ return false; } for(j = 3; j <= Math.sqrt(x); j+=2){ if(x % j == 0 && x ! … j == 0){ maxPrimeDiv = j; }else{ continue; } } return maxPrimeDiv; } console.log(euler()); …
3 votes
1 answer
269 views

Highly divisible triangular number

Highly divisible triangular number, my solution My solution of challenge from Project Euler takes too much time to execute. Although on lower numbers it works fine. … So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... …
2 votes
1 answer
4k views

The smallest positive number that is evenly divisible by all of the numbers from 1 to 20

divisible by > > 1, so 1 can be removed from the list and use 2 through 20 instead. 4- we can eliminate other factors as well. 5- We leave 20 in the calculation but then remove its factors {2, 4, 5, 10 … My Solution This is my solution for problem 5 of Project Euler using Python: def LCM(a, b): '''Return the least common multiple of the specified integer arguments ''' return a // …
7 votes
2 answers
3k views

Prime factorization for integers with up to 9-digit long prime factors

I've become interested prime factorization since solving Project Euler problem 3 (finding the largest prime factor of 600851475143). … 2, 2, 2, 3, 3, 3, 3, 3, 11] 0:00:00 [2, 2, 2, 2, 3, 3, 3, 3, 3, 5] 0:00:00 [2, 2, 2, 2, 3, 3, 3, 3, 3, 5, 5] 0:00:00 [2, 2, 2, 2, 3, 3, 3, 3, 3, 5, 5, 11, 11, 11] 0:00:00 [71, 839, 1471, 6857L] 0:00:00 …
6 votes
3 answers
1k views

Project Euler #47: Distinct primes factors

numbers to have three distinct prime factors are: 644 = 22 × 7 × 23 645 = 3 × 5 × 43 646 = 2 × 17 × 19. … { return false; } if (value % 2 == 0) { return value == 2; } if (value % 3 == 0) { return value == 3; } if (value % 5 == 0) { return value == 5; } if (value == 7) { return …
5 votes
2 answers
2k views

Speedup for Project Euler 44 - pentagon numbers

I'm trying to solve the problems of Project Euler with Haskell within less than 10s with optimized code (ghc -O2). … Pentagonal numbers are generated by the formula, \$P_n=n(3n−1)/2\$. …
4 votes
3 answers
217 views

Project Euler #2 in F#

Project Euler Problem 2 asks for the sum of all even Fibonacci numbers below 4 million. My first attempt at this problem using functional programming with F#. … open System let rec fib n = match n with | 0 | 1 | 2 -> n | _ -> fib (n - 1) + fib (n - 2) let rec nOfFibTermsUpUntil x y = if fib (y + 1) < x then nOfFibTermsUpUntil …
6 votes
2 answers
13k views

What is the 10001st prime number?

Project Euler problem 7 says: 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 10001st prime number? … System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace p7 { // By listing the first six prime numbers: 2, …

1
2 3 4 5
22
15 30 50 per page