diff options
| author | Dave Jacoby <jacoby.david@gmail.com> | 2022-06-16 18:07:18 -0400 |
|---|---|---|
| committer | Dave Jacoby <jacoby.david@gmail.com> | 2022-06-16 18:07:18 -0400 |
| commit | e28b4f047990a21b3e98b4e7b6b9e21f499d388a (patch) | |
| tree | 39ed88bfdf9d2689042d534606601a19edc0bf9b /challenge-169/eric-cheung/python/ch-1.py | |
| parent | b9ec9ea5dac6ae173154732b1c3f997676f798b9 (diff) | |
| parent | 5c4b8df3cd8a191dd7c42fc49e12b5dfc3a02cc2 (diff) | |
| download | perlweeklychallenge-club-e28b4f047990a21b3e98b4e7b6b9e21f499d388a.tar.gz perlweeklychallenge-club-e28b4f047990a21b3e98b4e7b6b9e21f499d388a.tar.bz2 perlweeklychallenge-club-e28b4f047990a21b3e98b4e7b6b9e21f499d388a.zip | |
Merge branch 'master' of https://github.com/manwar/perlweeklychallenge-club
Diffstat (limited to 'challenge-169/eric-cheung/python/ch-1.py')
| -rwxr-xr-x | challenge-169/eric-cheung/python/ch-1.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/challenge-169/eric-cheung/python/ch-1.py b/challenge-169/eric-cheung/python/ch-1.py new file mode 100755 index 0000000000..aa1dde99b9 --- /dev/null +++ b/challenge-169/eric-cheung/python/ch-1.py @@ -0,0 +1,46 @@ +
+## Remarks
+
+import math
+
+def PrimeFact(nInput):
+
+ for nDiv in range(2, int(math.sqrt(nInput)) + 1):
+ if nInput % nDiv == 0:
+ return nDiv
+
+ return 0
+
+
+def IsBrillNum(nInput):
+
+ nFact = PrimeFact(nInput)
+
+ if nFact == 0:
+ return False
+
+ nFact_2 = int(nInput / nFact)
+
+ nNum = PrimeFact(nFact_2)
+
+ if nNum > 0:
+ return False
+
+ if len(str(nFact)) == len(str(nFact_2)):
+ return True
+
+ return False
+
+
+## nOrigInputNum = 5
+## print (IsBrillNum(nOrigInputNum))
+
+nCount = 0
+nLoop = 4
+
+while nCount < 20:
+ if IsBrillNum(nLoop):
+ print(nLoop)
+ nCount = nCount + 1
+
+ nLoop = nLoop + 1
|
