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: update sum to cube #318

Closed
wants to merge 1 commit into from

Conversation

suiwater
Copy link
Contributor

pub fn is_armstrong_number(mut num: u128) -> bool {
    let original_num = num;
    let mut sum = 0;
    let digits = count_digits_of_base(num, 10);
    loop {
        if num == 0 {
            break original_num == sum;
        }

        let lastDigit = num % 10;
        let sum = sum + pow(lastDigit, digits);
        num = num / 10;
        if sum > original_num {
            break false;
        }
    }
}

The original code may have been like this, so using variable sum is not suitable now

@suiwater suiwater requested a review from 0xLucqs as a code owner June 25, 2024 05:44
Copy link

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale No activity for quite some time. label Jul 25, 2024
@0xLucqs 0xLucqs removed the stale No activity for quite some time. label Jul 31, 2024
Copy link

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions bot added the stale No activity for quite some time. label Aug 31, 2024
@github-actions github-actions bot closed this Sep 7, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stale No activity for quite some time.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants