Posts Tagged ‘Project Euler’

Generating many prime numbers

Leonhard Euler

Today, a fellow student claimed that it would take much time to check the first 1,000,000 numbers for primes. I claimed that it would be a matter of seconds to do so for the first 1,000,000,000 numbers. So, lets prove my claim. Trivial approach Execute it for 100,000,000: So 41 seconds for all primes not [...]

The Collatz sequence

Collatz sequence - Thumbnail

The goal of this post is to show you some tools that allow you to visualize data. And I also want to analyze some basic characteristics of the Collatz sequence. The Collatz sequences of a number is defined like this: So the sequence is defined as: You can define a directed graph like this: I [...]

Project Euler: Problem 35

Leonhard Euler

The task in Problem 35 of Project Euler is: The number, 197, is called a circular prime because all rotations of the digits: 197, 971, and 719, are themselves prime. There are thirteen such primes below 100: 2, 3, 5, 7, 11, 13, 17, 31, 37, 71, 73, 79, and 97. How many circular primes [...]

Project Euler: Problem 33

Leonhard Euler

The task in Problem 33 of Project Euler is: The fraction is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that , which is correct, is obtained by cancelling the 9s. We shall consider fractions like, , to be trivial examples. There are exactly four non-trivial examples of [...]

Project Euler: Problem 32

Leonhard Euler

The task in Problem 32 of Project Euler is: We shall say that an -digit number is pandigital if it makes use of all the digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 through 5 pandigital. The product 7254 is unusual, as the identity, , containing multiplicand, multiplier, and [...]

Project Euler: Problem 26

Leonhard Euler

The task in Problem 26 of Project Euler is: Find the value of d < 1000 for which contains the longest recurring cycle in its decimal fraction part. How to solve Think about how you divide with pen and paper. How do you recognize that you have a cycle? You look at the rest. If [...]

Python one-liners for Project Euler

Python-Logo

Today, I’ve been trying to get used to Pythons functional programming tools by solving Project-Euler tasks. To make them more interesting, I’ve solved them in one line. But I realized, that it is difficult to read online as only about 70 characters get displayed without a scrollbar. So I made multi-line solutions out of them. [...]