-
-
Notifications
You must be signed in to change notification settings - Fork 43.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Goldbach's conjecture #11131
Added Goldbach's conjecture #11131
Changes from all commits
69b324d
f3503f1
493711b
7e27de1
c6587dd
d51ecde
7acf5c9
530a195
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" | ||
This program will search every even number less than the inputted number | ||
and then show which numbers passed the test and which didn't. | ||
""" | ||
|
||
|
||
def isprime(num): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: |
||
value = False | ||
|
||
if num == 1: | ||
# print(num, "is not a prime number") | ||
pass | ||
elif num > 1: | ||
for i in range(2, num): | ||
if (num % i) == 0: | ||
value = True | ||
break | ||
if value == True: | ||
return False | ||
else: | ||
return True | ||
|
||
|
||
def istrue(x): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: Please provide descriptive name for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: Please provide descriptive name for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: Please provide descriptive name for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: Please provide descriptive name for the parameter: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please provide return type hint for the function: As there is no test file in this pull request nor any test function or class in the file Please provide type hint for the parameter: Please provide descriptive name for the parameter: |
||
t = 0 | ||
while t <= x / 2: | ||
if isprime(t) == 1 and isprime(x - t) == 1: | ||
return True | ||
t = t + 1 | ||
|
||
|
||
final_num = int(input("-->")) | ||
test_num = 4 | ||
A = [] | ||
B = [] | ||
while test_num <= final_num: | ||
if istrue(test_num) == 1: | ||
# print(test_num,"follows Goldbach's conjecture") | ||
A.append(test_num) | ||
else: | ||
print(test_num, "does not follow the Goldbach's conjecture") | ||
B.append(test_num) | ||
test_num = test_num + 2 | ||
print(A, "follow the Goldbach's conjecture") | ||
print(B, "does not follow the Goldbach's conjecture") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide return type hint for the function:
isprime
. If the function does not return a value, please provide the type hint as:def function() -> None:
As there is no test file in this pull request nor any test function or class in the file
maths/Goldbach's conjecture.py
, please provide doctest for the functionisprime
Please provide type hint for the parameter:
num