Repository navigation
Armstrong Numbers with big-integers - #1155
Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
There was a problem hiding this comment.
🟡 Changes recommended
instructions.append.md omits how to enable the opt-in tests and uses misleading/comma-splice wording, deviating from the convention followed by sibling bonus-test exercises (reverse-string, complex-numbers).
1 open issue
What changed in this PR
This PR enables the two previously-excluded big-integer canonical tests for the armstrong-numbers practice exercise, addressing the gap left by #1152. The tests are made opt-in (gated behind @isdefined(TEST_BIG_INTEGERS)) so the ~578 existing student solutions are not broken, while students who want the challenge can enable them. The example solution is updated to compute digit powers in the number's own type so 128-bit integers suffice without BigInt.
Changes:
- Un-exclude the two big-integer cases in
tests.tomland emit them inside aTEST_BIG_INTEGERS-gatedbig_integerstestset (template + generatedruntests.jl). - Update
.meta/example.jlto usedigits(typeof(n), n)so powers are computed intypeof(n)(Int128 for the big literals), avoiding Int64 overflow. - Add a stub comment and
.docs/instructions.append.mddescribing the optional bonus.
| File | Description |
|---|---|
.meta/tests.toml |
Removes include = false from the two big-integer cases so they are generated. |
.meta/template.j2 |
Splits cases into the normal loop and a @isdefined(TEST_BIG_INTEGERS)-gated bonus loop. |
runtests.jl |
Regenerated output containing the opt-in big_integers testset. |
.meta/example.jl |
Reworked solution using digits(typeof(n), n) to avoid overflow; sets the enabling const. |
armstrong-numbers.jl |
Stub gains a commented-out line to enable the optional tests. |
.docs/instructions.append.md |
New bonus note stating 128-bit integers suffice. |
I verified the correctness claim: both literals (186...976990 and 115...522401) parse as Int128, and every intermediate k^length(d) term and the accumulated sum stay within Int128 max, so the "no need for BigInt" statement holds for the example solution.
Review effort: Balanced
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
depial
left a comment
There was a problem hiding this comment.
Again, I'd assume it's the extra info in the append.md throwing the translation issue, but I still haven't read too much into that whole thing yet.
|
The translation thing: once everything is finalized, we add the Within 10 minutes (usually), we get a "translated" message and can merge. It adds a bit of delay, but it seems a price worth paying to bring in more non-anglphone students. |
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
This PR has been translated 🚀 |

I think this gets us to where #1152 fell disappointingly short. It runs correctly in Docker. Admittedly, not at my first attempt.