A positive integer n.
It is composed by numeral 3 and 7, and this number, and this number
you figures and multiples are 3 and 7, for the minimum of n
must process.
# Coding = UTF-. 8 Import numpy AS NP x_num =. 1 the while True: x_str = STR (x_num) # numbers to characters x_str_list = List (x_str) # to convert the tuple list x_str_len = len (x_str_list) # list element the number x_com x_num = # for subsequent whether the condition is not satisfied because the number continues to push to cause x_str_list_num Map = (int, x_str_list) # character array into a digital array sum_x = np.sum (x_str_list_num) # of an array sum for Word in x_str_list: # strings of characters in order to extract IF ((int (Word) == 3or int (Word) ==. 7) and (21 is x_num% == 0) and (0 == 21 is sum_x%) and ( ' . 3 ' in x_str_list) and ( ' . 7 ' in x_str_list)): # The number must contain 3 and 7, and the book is a multiple of 21, and the sum of the individual bits in multiples of 3 and 7 continue # continue this cycle the else : x_num = x_num + 21 # If the condition is not satisfied, then, after the digital shift BREAK # breaks out a loop IF x_com == x_num: # If you meet the requirements, that is, on a normal cycle for the end, out of the while loop BREAK the else : Print(x_num) the Continue # If the condition is not met, the while loop continues Print (x_num)
The result: 3333377733
computational efficiency should be improved