Ad
  • Custom User Avatar

    What, no FeelingsPartyFactory?

  • Custom User Avatar

    What about numbers in other representations, e.g. hex values? The description doesn't mention bases, I'd expect it to work for all bases.

    But digital_root(0xff) would be by definition (the recursive sum of all the digits) 0xf + 0xf = 0x1e -> 0xf. Treating 0xff as a base-10 number (255) leads to a different result (3).

    For a complete solution, I'd say one should make the function also require a base, or mention that base 10 is assumed in the description.