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

feat: add carmichael number checker #258

Closed

Conversation

Soptq
Copy link
Contributor

@Soptq Soptq commented Jan 24, 2024

This PR adds Carmichael number checker.

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Issue Number: N/A

What is the new behavior?

  • checking whether a bumber is a Carmichael number.
  • all tests are passed.

Does this introduce a breaking change?

  • Yes
  • No

Other information

@Soptq Soptq requested a review from 0xLucqs as a code owner January 24, 2024 15:16
Copy link
Collaborator

@0xLucqs 0xLucqs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add more tests this is a bit light

@Soptq
Copy link
Contributor Author

Soptq commented Jan 25, 2024

add more tests this is a bit light

Thanks for the advice, more tests are added ;). Note that 561 is the smallest Carmichael number (later is 41041, which requires about 1 billion gas to check and is too time-consuming for testing).

@0xLucqs
Copy link
Collaborator

0xLucqs commented Jan 25, 2024

then is it really useful to have that function ?

@Soptq
Copy link
Contributor Author

Soptq commented Jan 25, 2024

then is it really useful to have that function ?

Indeed. The complexity of this function is too high for a smart contract. I think if someone really wants to check if a given number is a carmichael number, he/she can simply hard-coded carmichael numbers into a list and check if the given number is inside the list.

I will close this PR due to the low practicality.

@Soptq Soptq closed this Jan 25, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants