-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProblem 129.py
More file actions
40 lines (34 loc) · 817 Bytes
/
Problem 129.py
File metadata and controls
40 lines (34 loc) · 817 Bytes
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
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 01 21:12:56 2016
@author: Lucas
"""
import lucaslib
import math
def repunit(n):
num = ''
for x in xrange(0,n):
num += '1'
return int(num)
def gcd(a, b):
if b > a:
return gcd(b, a)
if a % b == 0:
return b
return gcd(b, a % b)
for x in xrange(1000001,1000100,2):
if gcd(x,10) == 1:
running = True
i = len(str(x))+1
caughtrem = repunit(i)%x
while running:
if caughtrem == 0:
if i > 1:
print x
print i
# print i
# print
running = False
else:
caughtrem = (10*caughtrem+1)%x
i += 1