Original title:
If a number is exactly equal to the sum of its factors, this number is called "count them." E.g. 6 = 1 + 2 + 3. After programming to find all the numbers less than 1000.
My code:
# ! / Usr / bin / Python # encoding = UTF-8 # - * - Coding: UTF-8 - * - # a number of factors if it is exactly equal to the sum, this number is called "complete count." E.g. 6 = 1 + 2 + 3. After programming to find all the numbers less than 1000. X = int (INPUT ( " Please The INPUT Number: \ n- " )) # for labeling, the number of how many complete range finding; for I in Range (2, X +. 1): # digital-X. 1 S 0 = # factor sum K = int (0.5 * I) + 1'd for J in Range (. 1 , K): IF (J == 0% I) and (J =! I): S = S + J # print("==>",i,j,s) if i == s : print("################",i)
result:
Solution original title:
Used from SYS Import stdout
-------- (I am dividing line) --------
reference:
1. RUNOOB.COM:https://www.runoob.com/python/python-exercise-example19.html
Remarks:
Initial modified: October 3, 2019 11:42:59
Environment: Windows 7 / Python 3.7.2