Skip to content
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

day 1: rewrite fermat question 2 #177

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebooks/day1/01-basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ $a^n + b^n = c^n$
for any value of $n$ greater than 2.

1. Write a function named `checkfermat` that takes four parameters ($a$, $b$, $c$ and $n$) and checks to see if Fermat’s theorem holds. If $n$ is greater than 2 and $a^n + b^n == c^n$ the program should print, *"Holy smokes, Fermat was wrong!"* Otherwise, the program should print and return, *"No, that doesn’t work."*
2. Write a function that takes four random positive integers for $a$, $b$, $c$ and $n$, and use `checkfermat` to check whether they violate Fermat’s theorem.
2. Write a function that, when no input arguments are provided, four random positive integers are assigned to $a$, $b$, $c$ and $n$, and use `checkfermat` to check whether they violate Fermat’s theorem.
3. Can you write the code so that the functions in 4.1 and 4.2 have the same name?

Hints:
Expand Down