In Russia we have something like a tradition: we like to look for lucky tickets.
Here's what a regular ticket looks like:
As you can see, the ticket has a six-digit number.
A six-digit number is considered lucky if the sum of the first three digits is equal to the sum of the last three.
The number on the photo is not lucky:
038937 038 937 0 + 3 + 8 = 11 9 + 3 + 7 = 19 11 != 19
Given the limits of a range (inclusive), return the number of lucky ticket numbers contained within it.
- Input: 2 integers: the first and last integers in the range
- The inputs will be between 0 and 999999 inclusive
- Output: 1 integer: how many lucky numbers are in the range
- You may take the inputs and return the output in any acceptable format
- Assume leading zeros for numbers less than 100000.
0, 1 => 1 100000, 200000 => 5280 123456, 654321 => 31607 0, 999999 => 55252
This is code-golf so the shortest answer in bytes in every language wins.