Skip to main content

All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
481 views

Project Euler Problem #755

As the title indicates this is one of the last most problems of Project Euler. The problem is straightforward. However, similar to the rest of the Euler Project problems either ...
Lady Be Good's user avatar
16 votes
5 answers
6k views

Project Euler # 25 The 1000 digit Fibonacci index

The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 ...
user avatar
4 votes
2 answers
2k views

Foobar Challenge: Lovely Lucky Lambs

I've been able to reduce my solution to constant time. Is it possible to reduce this by any constant factor further? (Besides trivialities i.e. inserting constants, not lazy importing). Specifically, ...
Michael Choi's user avatar
11 votes
2 answers
5k views

Lovely Lucky LAMBs

I am trying to solve this question from google's foobar. However, my code exceeds the time limit, even though when I tested it I got correct answers. How can I make my code more efficient? Lovely ...
ngmh's user avatar
  • 113
5 votes
5 answers
7k views

Finding large Fibonacci Number in Python

I'm doing Project Euler at 1000-digit Fibonacci number - Problem 25 which says The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. ...
user avatar
7 votes
4 answers
11k views

Project Euler problems 1 and 2 in python

What do you think about my code? I am a beginner and just started doing some algorithmic exercises to sharpen up my python skills. Here is code for problem #1: ...
doublemc's user avatar
  • 285
3 votes
2 answers
625 views

Zeckendorf Representation of positive integer

Zeckendorf's theorem states that all positive integers can be represented uniquely as the sum of one or more distinct Fibonacci numbers in such a way that the sum does not include any two consecutive ...
MooingRawr's user avatar
3 votes
1 answer
858 views

Modified Fibonacci method implementation - dynamic programming

I found this question on Hackerrank in dynamic programming: Define a modified Fibonacci sequence as: $$t_{n+2} = t_n + t_{n+1}^2$$ Given three integers, \$t_1\$, \$t_2\$, and \$n\$, compute ...
tessie's user avatar
  • 315
9 votes
4 answers
939 views

Project Euler #2 in Python

Here is my Python code for Project Euler #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, ...
bbali's user avatar
  • 303
2 votes
1 answer
222 views

Project Euler #2: sum of even Fibonacci numbers, using generators

I am currently working on Project Euler problem #2 which requires you to print the sum of all even fibonacci numbers below 4 million. I just recently learned about generators and from my ...
Dominik Schmidt's user avatar
3 votes
1 answer
1k views

Finding the nth element of generalized Fibonacci sequences

I solved the Fibonacci Golf problem on checkio.org: The Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21... This is not ...
Juanvulcano's user avatar
7 votes
4 answers
3k views

More efficient solution for Project Euler #2 (sum of Fibonacci numbers under 4 million)

I would like to get some feedback on my code. I am starting to program after doing a few online Python courses. Would you be able to help me by following my track of thinking and then pinpointing ...
technicus fragmentum's user avatar
11 votes
3 answers
24k views

Project Euler Question #2: Sum of even Fibonacci numbers under 4 million

The question is: 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, ...
wioh's user avatar
  • 111
2 votes
3 answers
859 views

Maintaining the Single Responsibility Principle with Project Euler #2

This is my solution to Project Euler problem 2: By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. The class ...
Sarawut Positwinyu's user avatar
3 votes
3 answers
980 views

Project Euler - Shortening Problem 2

You might have read my question on shortening my code to a one-liner for Problem 1. So, I was wondering, is there any more tricks of the trade to shorten my Problem 2 solution: ...
LazySloth13's user avatar
  • 1,301
13 votes
4 answers
29k views

Python Solution for Project Euler #2 (Fibonacci Sums)

I'm a fairly new programmer (just started yesterday!). I decided to tackle Project Euler #2 today, as I did #1 yesterday without many problems. I came up with what seems to me to be a working solution,...
bckwth's user avatar
  • 451