Clash - Flash - Happy Number - PHP - Bug


for some days I resolve the 5min Clash: “Check if a positive number is happy or not.”, I do it in PHP and always the 4th case does not match, now I have a screenshot to show the problem.

You can see in border2 the output and the expected data of the test case, how you can see in code, I take the number from input and output the number unchanged.

Please could you check, if there is a bug in the PHP test case 4, I only get 75%, when I try to solve the puzzle in PHP.

best regards


The problem is the input fscanf(STDIN, “%d”, $N);
%d converts the input to

        d - the argument is treated as an
        integer, and presented as a (signed) decimal number.

and the 999999… number is bigger, than MAX_INT_PHP.

For fairness, it was better, if the number was decreased or in php use %s:

         s - the argument is treated as and
         presented as a string.

Here are the specifications of PHP:
format output

There is the same problem win many clashes when you use php or javascript. You can’t use a long or a unsigned int. So you are stuck because you just can’t a parse a too big integer. I try to flag every clashes i see with this problem.

not only stucked, you cannot reach 100%.
Well now I know it and next time I am going to modifiy the input to “%f” or “%s”, but an unexperienced coder or new player on CodinGame will not be able to find the reason of the error message, so PHP-Users are handicapped, when the input returns incorrect data.