전체 글 142

Project Euler #23 - Non-abundant sums

A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number.A number n is called deficient if the sum of its proper divisors is less than n and it is called abundant if this sum exceeds n.As 12 is the smallest abundant number, 1 + 2..

Project Euler #21 - Amicable numbers

Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, 44, 55 and 110; therefore d(220) = 284. The proper divisors of 284 are 1, 2, 4, 71 and 142; so d(284..

Project Euler #20 - Factorial digit sum

n! means n × (n − 1) × ... × 3 × 2 × 1For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.Find the sum of the digits in the number 100! 출처: https://projecteuler.net/problem=19 100! 의 각 자릿수를 더하는 문제입니다.매우 큰 수이기 때문에 일반적인 곱셈으로는 구할 수 없습니다. my solvingc++123456789101112131415161718192021222324252627282930313233343536373839..

Project Euler #19 - Counting Sundays

You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twenty-nine.A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400...