-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex_52.py
executable file
·34 lines (31 loc) · 1.02 KB
/
ex_52.py
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
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 3 11:29:20 2021
@author: Daneshjoei
"""
"""example 52:
It can be seen that the number, 125874, and its double
, 251748, contain exactly the same digits, but in a
different order.
Find the smallest positive integer, x, such that 2x,
3x, 4x, 5x, and 6x, contain the same digits.
"""
counter=1
while True:
if set(str(counter))==set(str(2*counter))==set(str(3*counter))==set(str(4*counter))==set(str(5*counter))==set(str(6*counter)):
print (counter)
break
counter+=1
"""
#the running time of both codes is approx equal
counter=1
while True:
if set(str(counter))==set(str(2*counter)):
if set(str(2*counter))==set(str(3*counter)):
if set(str(3*counter))==set(str(4*counter)):
if set(str(4*counter))==set(str(5*counter)):
if set(str(5*counter))==set(str(6*counter)):
print (counter)
break
counter+=1
"""