Ad
  • Custom User Avatar

    Numbers with a leading zero are (in some programming languages) interpreted as octal (base 8). 17 in the octal number system is 15 in the decimal numer system (base 10). squareDitigts(15) gives 125, since 1² = 1, and 5² = 25.

    You can use the hexadecimal system by prefixing the number with 0x, and binary with 0b. At least in JavaScript.
    017 = 0xf = 0b1111 = 15.