• Forum
  • Lounge
  • Break an integer > 1000 into a set of va

 
Break an integer > 1000 into a set of values between 1 and 999

I could probably figure this out if it wasn't almost 5:30 in the morning. But, an example:

given 123,456,789; the set would be {123,456,789}

Any idea how I could do this mathematically? In practice, I could do this by making a string of 123456789 and substringing it, but I'd rather avoid that.
I think you can repeatedly call something like:

1
2
setEntry[i] = n % 1000.
n /= 1000.
That'll work! Thanks!
Topic archived. No new replies allowed.