Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- CNN
- 합성곱 신경망
- bayesian
- neural network
- 오일러 프로젝트
- 베이지안
- 딥러닝
- 역전파법
- deep learning
- 역전파
- A Neural Algorithm of Artistic Style
- 자전거 여행
- 소수
- project euler
- 히토요시
- c#
- 냥코 센세
- 전처리
- Convolutional Neural Network
- mnist
- Python
- Autoencoder
- SQL
- Gram matrix
- 소인수분해
- 수달
- backpropagation
- 오토인코더
- 비샤몬당
- 신경망
Archives
- Today
- Total
통계, IT, AI
[Project Euler] 52. Permuted multiples 본문
1. 개요
문제는 이곳에서 확인할 수 있다.
2. 구현
문제의 특성을 잘 살펴보면 확인해야 할 숫자를 많이 줄일 수 있다. 먼저
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # -*- coding: utf-8 -*- i = 1 while True : # 3x가 3의 배수이고 x와 3x의 digit이 같으므로 x도 3의 배수이다. x = 3 * i x_digit = sorted ( list ( map ( int , str (x)))) # 6x와 x의 digit이 같으므로 x는 1로 시작한다. # 5x가 5의 배수이므로 x는 0 또는 5를 포함한다. # 2x가 2의 배수이므로 x는 0, 2, 4, 6 또는 8을 9포함한다. if x_digit[ 0 ] ! = 1 or not any (d in [ 0 , 5 ] for d in x_digit) or not any (d in [ 0 , 2 , 4 , 6 , 8 ] for d in x_digit): i + = 1 continue result = True for k in range ( 2 , 7 ): result & = x_digit = = sorted ( list ( map ( int , str (k * x)))) if result: print (x) break i + = 1 |
답은 142857이다.
'IT > PROJECT_EULER' 카테고리의 다른 글
[Project Euler] 54. Poker hands (0) | 2017.07.26 |
---|---|
[Project Euler] 53. Combinatoric selections (0) | 2017.07.22 |
[Project Euler] 51. Prime digit replacements (0) | 2017.07.19 |
[Project Euler] 50. Consecutive prime sum (0) | 2017.05.14 |
[Project Euler] 49. Prime permutations (0) | 2017.05.14 |
Comments