본문 바로가기

Programming/Project Euler

(45)
[C/C++] Project Euler #40 - Champernowne's Constant Champernowne’s constant is an irrational number created by concatenating natural numbers in order, such as 0.123456789101112131415…. The problem requires finding the digits at specific positions in this sequence and calculating the product of these digits. For example, the 1st digit after the decimal point is 1, the 2nd is 2, and the 10th is 1. By following this pattern, we need to extract the d..
[C/C++] Project Euler #39 - Integer Right Triangles Project Euler #39 is a relatively easy problem with a difficulty rating of 5%. As the title suggests, it is about Pythagorean triangles. A Pythagorean triangle is a right triangle where all side lengths are integers. The fundamental relationship for such a triangle follows the well-known Pythagorean theorem: \[ a^2 + b^2 = c^2 \] If there exists an integer triplet (x, y, z) satisfying the equati..
[C/C++] Project Euler #38 - Pandigital Multiples In Project Euler Problem 38, the goal is to use the concepts of “pandigital numbers” and “multiplication” to find the largest number that satisfies specific conditions. A pandigital number is defined as a number in which each digit from 1 to 9 appears exactly once. For example, 192384576 is considered a pandigital number because it contains all digits from 1 to 9 without repetition. The problem ..
[C/C++] Project Euler #37 - Truncatable Primes Truncatable Prime refers to a very special type of prime number. These numbers retain their primality even when digits are removed one by one from the left or from the right. For example, while a regular prime is defined as a number divisible only by 1 and itself, Truncatable Primes not only meet this condition but also require that all numbers formed by progressively removing digits remain prim..
[C/C++] Project Euler #36 - Double-base Palindromes Project Euler Problem #36 - “Double-base Palindromes” is about finding numbers that are palindromic in both decimal and binary representations.  For example, 585 is a palindrome in decimal (585) and also a palindrome in binary (1001001).  The task is to find such numbers, calculate their sum, and output the result.There are various ways to determine if a number is a palindrome and to generate pa..
[C/C++] Project Euler #35 - Circular Primes Project Euler’s Problem #35 deals with “circular primes.”  A circular prime is defined as a prime number such that every rotation of its digits is also a prime.  For example, consider 197: if you rotate its digits, you get 197, 971, and 719—all of which are prime. Therefore, 197 is a circular prime. The question asks how many such circular primes exist below 1,000,000. For reference, there are 1..
[C/C++] Project Euler #34 - Digit Factorials This problem is about finding numbers that are equal to the sum of the factorials of their digits.For example, the number 145 is such a number because\[1! + 4! + 5! = 1 + 24 + 120 = 145\]This problem asks you to find the sum of all such numbers.If you've been working on Project Euler problems up to this point, you probably have some experience with extracting digits from a decimal number.In my c..
[C/C++] Project Euler #33 - Digit Cancelling Fractions Project Euler #33 problem is about “Digit Cancelling Fractions.” This problem involves finding fractions where both the numerator and denominator are two-digit numbers and satisfy a specific condition. The condition is that when the numerator and denominator share the same digit, and this digit is “cancelled” in a simple way, the resulting fraction must still equal the original fraction.For exam..
[C/C++] Project Euler #32 - Pandigital Products Project Euler #32 is a relatively low-difficulty problem with a difficulty level of 5%.A pandigital number is a number formed by using all digits within a specific range exactly once. For example, combinations such as 123456789 or 391867254, which include all digits from 1 to 9 exactly once, are called pandigital. In this problem, the condition requires using all digits from 1 to 9 exactly once...
[C/C++] Project Euler #31 - Coin Sums In the UK, the following coin denominations are available:• 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p), £2 (200p).The goal is to find the number of unique combinations of these coins that sum to 200 pence (£2).Conditions:1. Coins can be used repeatedly as needed.2. The order of coins does not matter (e.g., {1p, 2p} is considered the same as {2p, 1p}).3. Only unique combinations should be counted. In t..