본문 바로가기

Project Euler21

Problem 16 - Power digit sum 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. What is the sum of the digits of the number 2^1000? [출처 - projecteuler.net/] 이번에는 문제가 엄청 짧습니다. 문제만 본다면 단순하게 그냥 2에 대해서 거듭제곱을 계속하여 원하는 만큼 수행했을때, 결과값에 대해서 각 자리수에 대한 단순합을 구하는 문제입니다. 하지만 15번 거듭제곱을 수행하면, 누구는 그냥 머리도로 구할 수 있을 것 입니다. 2^10 * 2^5 = 1,024 * 32 = 32,768 이 되겠죠. 그럼 문제와 같이 각 자리수를 더해서 26을 바로 도출해 낼 수 있습니다. 하지만 1,000번이나 거듭제곱을 한다면..... 2020. 12. 7.
Problem 15 - Lattice paths Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. How many such routes are there through a 20×20 grid? [출처 - projecteuler.net/] 이번 문제는 start 부터 end까지 가는 길의 경우의 가지 수를 구하는 문제가 되겠습니다. 그래도 중구난방에 장애물도 있고 그런 문제는 아니고... 그냥 정사각형의 grid에서 왼쪽꼭대기에서 오른쪽 바닥까지 이동하는 길의 가지 수 입니다. 다만 모든 길은 우/하 (즉 오른쪽 or 아래)로만 이동.. 2020. 12. 3.
Problem 14 - Longest Collatz sequence The following iterative sequence is defined for the set of positive integers: n → n/2 (n is even) n → 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 → 40 → 20 → 10 → 5 → 16 → 8 → 4 → 2 → 1 It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. Although it has not been proved yet (Collatz Problem), it is though.. 2020. 12. 1.
Problem 13 - Large sum Work out the first ten digits of the sum of the following one-hundred 50-digit numbers. 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171980310421047513778063246676 ............... [출처 - projecteuler.net/] 이번에는 50개의 자리수를.. 2020. 11. 30.