https://www.codingame.com/training/easy/number-derivation
Send your feedback or ask for help here!
Created by @nicola,validated by @ViktorCs,@Scarlatine and @Vestiaz.
If you have any issues, feel free to ping them.
https://www.codingame.com/training/easy/number-derivation
Send your feedback or ask for help here!
Created by @nicola,validated by @ViktorCs,@Scarlatine and @Vestiaz.
If you have any issues, feel free to ping them.
I don’t understand, what exactly I should do. Even by looking at the test cases, I still have no clue. Is every integer n either a prime or a product of primes?
Yes, every positive integer is a product of primes: Integer factorization - Wikipedia
An example of how you can solve Testcase 4:
n = 42
42 = 2 * 21
42’ = (2 * 21)’ = 2’ * 21 + 2 * 21’ = 21 + 2 * 21’
21’ = (7*3)’ = 7’ * 3 + 3’ * 7 = 1 * 3 + 1 * 7 = 10
=> 42’ = 21 + 2 * 10 = 41
Yes, except 1 and 0.
It’s the fundamental theorem of arithmetic.
I changed “given number” for “given positive integer” to make it clearer - though you can guess it easily from the “arithmetics” tag and it’s stated later than the number is >1.
Does this work for numbers with four prime numbers as for eg:210 goes on
Of course.
Great puzzle. Code implementation turned out to be quite short, but this shook some rust off my math knowledge.
I think description would be more readable if each equations and constants are specified with markdown and each on their own line respectively
Can you please show an example of such markdown in a puzzle?