Timeline for Test a number for narcissism
Current License: CC BY-SA 3.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| May 17, 2017 at 16:51 | comment | added | Jörg Hülsermann | Can be golfed to this for(;$i<$l=strlen($a=$argn);)$s+=$a[$i++]**$l;echo$s==$a; | |
| Nov 14, 2013 at 15:13 | comment | added | Vlad Preda | @manatwork: Thank you for the warm welcome to codegolf :) | |
| Nov 14, 2013 at 15:12 | history | edited | Vlad Preda | CC BY-SA 3.0 | added 46 characters in body |
| Nov 14, 2013 at 15:09 | comment | added | manatwork | As you already have a statement which generate a notice, just add another: remove the loop control variable initialization. Incrementing the loop control variable also not need to be a standalone statement. And the braces are definitely not needed: <?for(;$i<$l=strlen($a=$argv[1]);)$s+=pow($a[$i++],$l);echo$s==$a;. | |
| Nov 14, 2013 at 15:07 | history | edited | Vlad Preda | CC BY-SA 3.0 | added 46 characters in body |
| Nov 14, 2013 at 14:58 | comment | added | manatwork | Don't assign $a and $l in separate statements. <?for($i=0;$i<$l=strlen($a=$argv[1]);$i++){$s+=pow($a[$i],$l);}echo$s==$a; is shorter. | |
| Nov 14, 2013 at 14:58 | review | First posts | |||
| Nov 14, 2013 at 20:10 | |||||
| Nov 14, 2013 at 14:41 | history | answered | Vlad Preda | CC BY-SA 3.0 |