[Community Puzzle] Happy Numbers

When I have code this on Php, I have had a problem with the “\n”.
The last ligne was wrong because the end of response was a “\n”. But I was coding in same time , in same language (Php) with the same external Ide and moreover use him code. My friend haven’t this problem but me yes.
A problem of Codingame Ide ? @deltaspace

Review and updated the test case formatting. Would you try again?

I copy the response of my firend who have 100% - ArchibaldWirslayd
The result is the same : For first test I have
Trouvé : 24 :(End of line (\n)
Attendu : 24 :(Nothing
I succed by changing the display method of the response

php was designed for generating web pages which, I am not sure, may have special handling for CR and LR because browsers handle newlines in html in special ways.

I tested my code for all test cases and validators and passed with no surprise. My code is using C style printf("%d :)\n", a);
or printf("%s :)\n", s);

I understood. I know that Php is a web language. But I found anormal that In exactly same conditions. The same code submit at same time give different result.
I have tryed with ascii code for chars, and he give me the code, not the char linked on ascii code. So I suppose that all chars are escape to protect the ide except the importants like “\n” who is the unique way to pass to the next line . “<br>” are use for html but he is escape .

on conclusion I don’t know why I have had this problem. Maybe unluck.
I hope to find a solution for the future or challenge the staffs.

again thx for your responses.

Encore merci pour tes réponses. (j’avoue je suis francophone ^^)

Remember that php also have printf().
Have you tried using it to replace all these echo, log, print, etc?

@Gaiel It’s almost impossible to understand your problem without a sample of code. Do you mean the currently published PHP solution by ArchibaldWirslayd raises that error when you run it?

exactly @Niako

print_f, print_r give the same result like echo And I have tried to replace "\n" with "\r\n" or PHP_EOL .the result is same. @java_coffee_cup

Based on the php manual there is no print_f, but there is printf()

Anyway, as you have passed it with php, you can view other php coders’ solutions to find out how they can do it without error and without special handling of newlines.

Yeah but, as far as I understand, he is claiming that some accepted solutions (or at least one) raise an error when he runs them (on the tests).

This strange situation is too odd to understand.

In this kind of inconsistent and random errors, often I would suggest performing the same task in a different browser, or better a different computer, in a different network, so that there can be various combinations of independent testing results as reference.

Some special reasons I have come across are: virus infection, or the user installed a plug-in to browser that automatically manipulates text input, or a malfunctioned keyboard that output key signals in random intervals, or company’s intranet has kinds of monster monitoring software. Would like to hear if there are other strange causes.

the only thing i could say is.
in the generate code for php, at the start of problem (any probleme) he is asking to

// Write an action using echo(). DON'T FORGET THE TRAILING \n
// To debug (equivalent to var_dump): error_log(var_export($var, true));

That’s indeed a good start (one could also start by clearing the cache, or monitoring the network request when clicking on “play” to make sure the code you send is indeed the one you see in the IDE).

I wrote a Code in C#. It works for all the tests and the validations 1-4 but the validation 5 does not work. Can someone provide the input data for the 5.validation test so that I can check where my code has the failure.
Thanks for your help.

Input:

50
7
8
86
10
32
10
310
913
108
3925
57714
204650
3935999
8869716
5310265
1305462
81915006
62187788
37434030
82893156
357558526
389679728
429968695
4614121900
3273949923
3402040497
8390063700
75860300187
3830929637583
7456574720517
76083067902031
43231406433477
84658586744469
566855069295730
293024126836742
6987862321189978
2481331054005573
8550506486727537
52611351637349120
633736527285728075
4280271021537705216
7923785328480252021
74692295997080392994
342639328902349085500
3635171293808307965209
4610726264688936129498
2411843019493615815308
89073551194714198974652
3547617484839572359410360
7547346898512036957709921

Output

7 :)
8 :(
86 :)
10 :)
32 :)
10 :)
310 :)
913 :)
108 :(
3925 :(
57714 :(
204650 :(
3935999 :)
8869716 :)
5310265 :)
1305462 :)
81915006 :)
62187788 :)
37434030 :(
82893156 :(
357558526 :)
389679728 :(
429968695 :(
4614121900 :(
3273949923 :(
3402040497 :(
8390063700 :(
75860300187 :(
3830929637583 :)
7456574720517 :(
76083067902031 :)
43231406433477 :)
84658586744469 :(
566855069295730 :)
293024126836742 :(
6987862321189978 :(
2481331054005573 :(
8550506486727537 :(
52611351637349120 :(
633736527285728075 :(
4280271021537705216 :(
7923785328480252021 :(
74692295997080392994 :(
342639328902349085500 :(
3635171293808307965209 :)
4610726264688936129498 :(
2411843019493615815308 :(
89073551194714198974652 :(
3547617484839572359410360 :(
7547346898512036957709921 :(

Thanks so much for posting validator 5, and I found a careless mistake.

Hello to All :slight_smile: !
Thanks to @CGTeam and @TwoSteps : Groovy seems to build again :grinning: !
Unfortunately, all my Tests pass in Groovy, but none of the Validators …
→ Is there a mistake somewhere in my code ?
Thanks to anyone who can help me :wink: !

Issue is not in your code. We still have problems with Groovy for submissions. We’ll take care of it.

1 Like

OK, Thanks @TwoSteps for your reply and all the @CGTeam too for your job :slight_smile: !
→ I’ll wait for later Groovy submissions :wink:
Have a good day :sunny: !