Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A simpler way multiplication is recursive is the way it is defined for natural numbers in mathematics:

  a × b = 0                if b = 0
  a × b = a + a × (b - 1)  if b ≠ 0


a x b = a if b = 1


What is a + a x 0? :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: