Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Post History

60%
+1 −0
Sandbox Digit balanced numbers

posted 8d ago by trichoplax‭  ·  edited 5d ago by trichoplax‭

Article code-golf
#7: Post edited by user avatar trichoplax‭ · 2025-03-26T18:50:55Z (5 days ago)
Add alternative challenge for comparison
  • # Sandbox question
  • - Would this be better as indicating whether a specific number is digit balanced, rather than asking for the number of digit balanced numbers of a given length? Otherwise the outputs quickly become larger than most languages can handle, so either I'd have to keep the number of test cases very small, or have a set of test cases where most don't apply to most languages.
  • ---
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Example
  • ### Input 4
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • # Sandbox question
  • - Would this be better as indicating whether a specific number is digit balanced, rather than asking for the number of digit balanced numbers of a given length? Otherwise the outputs quickly become larger than most languages can handle, so either I'd have to keep the number of test cases very small, or have a set of test cases where most don't apply to most languages.
  • ---
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Example
  • ### Input 4
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • ---
  • Does a number have balanced numbers of distinct digits? That is, do the number's digits appear with equal frequency?
  • ## Input
  • - A positive integer N.
  • ## Output
  • - An indication of whether the number has balanced digits.
  • - This can be a truthy or falsy value (where you can choose whether truthy corresponds to balanced or unbalanced), or one of 2 distinct values.
  • ## Examples
  • - 1234 has 1 of each present digit, so is balanced.
  • - 1223 has 1 1 and 1 3, but 2 2s, so is not balanced.
  • - 1212 has 2 1s and 2 2s, so is balanced.
  • - 1000 has 1 1 and 3 0s, so is not balanced (zeroes are relevant).
  • - 1100 has 2 1s and 2 0s, so is balanced.
  • - 5555 has 4 5s, so is balanced.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • Note that you may choose any 2 distinct values instead of `true` and `false`, or you may use truthy and falsy outputs rather than consistent values.
  • ```text
  • 1 : true
  • 22 : true
  • 98 : true
  • 222 : true
  • 234 : true
  • 3456 : true
  • 3434 : true
  • 3355 : true
  • 4664 : true
  • 123456789 : true
  • 234567890 : true
  • 11223344 : true
  • 111222333 : true
  • 132321213 : true
  • 54554445 : true
  • 999999999 : true
  • 778 : false
  • 565 : false
  • 1223 : false
  • 2123 : false
  • 999999998 : false
  • 999989999 : false
  • 112233445 : false
  • 999999990 : false
  • 101202303 : false
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#6: Post edited by user avatar trichoplax‭ · 2025-03-26T01:32:40Z (6 days ago)
Add a sandbox question about a possible alternative challenge
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Example
  • ### Input 4
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • # Sandbox question
  • - Would this be better as indicating whether a specific number is digit balanced, rather than asking for the number of digit balanced numbers of a given length? Otherwise the outputs quickly become larger than most languages can handle, so either I'd have to keep the number of test cases very small, or have a set of test cases where most don't apply to most languages.
  • ---
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Example
  • ### Input 4
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#5: Post edited by user avatar trichoplax‭ · 2025-03-25T00:22:20Z (7 days ago)
Improve example headings
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Example
  • ### Input 4
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#4: Post edited by user avatar trichoplax‭ · 2025-03-25T00:20:36Z (7 days ago)
Mention OEIS and add test cases.
  • How many N digit numbers have balanced numbers of distinct digits?
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit non-negative integers (N digits with no redundant leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of _______ that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • TODO
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • How many N digit numbers have balanced numbers of distinct digits?
  • You may struggle to calculate this by brute force beyond single digit inputs, but the OEIS has a closed form formula under [Number of n-digit positive numbers whose digits occur with equal frequency](https://oeis.org/A261315).
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit positive integers (N digits with no leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of 4788 that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • 1 : 9
  • 2 : 90
  • 3 : 657
  • 4 : 4788
  • 5 : 27225
  • 6 : 146619
  • 7 : 544329
  • 8 : 2112084
  • 9 : 3447369
  • 10 : 28995255
  • 11 : 9
  • 12 : 1488185631
  • 13 : 9
  • 14 : 73556822205
  • 15 : 38222232057
  • 16 : 3321970172244
  • 17 : 9
  • 18 : 138479121435807
  • 19 : 9
  • 20 : 2209806802214163
  • 21 : 19711054740199689
  • 22 : 28570005
  • 23 : 9
  • 24 : 15574715941421647071
  • 25 : 141378216540777225
  • 26 : 421224309
  • 27 : 9724427617362202602009
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#3: Post edited by user avatar trichoplax‭ · 2025-03-24T03:43:27Z (8 days ago)
Improve sentence structure for clarity
  • How many N digit numbers have balanced numbers of distinct digits?
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit non-negative integers (N digits with no redundant leading zeroes) that have equal numbers of each present distinct digit.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of _______ that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • TODO
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • How many N digit numbers have balanced numbers of distinct digits?
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit non-negative integers (N digits with no redundant leading zeroes) that have equal numbers of each distinct digit that is present.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of _______ that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • TODO
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#2: Post edited by user avatar trichoplax‭ · 2025-03-23T23:55:46Z (8 days ago)
Clarify that digits to be counted are distinct
  • How many N digit numbers have balanced numbers of digits?
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit non-negative integers (N digits with no redundant leading zeroes) that have equal numbers of each present digit.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of _______ that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • TODO
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
  • How many N digit numbers have balanced numbers of distinct digits?
  • ## Input
  • - A positive integer N.
  • ## Output
  • - A positive integer M.
  • - This is the total number of N digit non-negative integers (N digits with no redundant leading zeroes) that have equal numbers of each present distinct digit.
  • ## Examples
  • ### 4 digits
  • - 1234 has 1 of each present digit, so counts towards the total.
  • - 1223 has 1 1 and 1 3, but 2 2s, so does not count.
  • - 1212 has 2 1s and 2 2s, so counts.
  • - 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
  • - 5555 has 4 5s, so counts.
  • - 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.
  • Assessing each 4 digit integer this way gives a total of _______ that have balanced digits.
  • ## Test cases
  • Test cases are in the format `input : output`.
  • ```text
  • TODO
  • ```
  • ## Scoring
  • This is a [code golf challenge]. Your score is the number of bytes in your code.
  • > Explanations are optional, but I'm more likely to upvote answers that have one.
  • [code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"
#1: Initial revision by user avatar trichoplax‭ · 2025-03-23T23:53:46Z (8 days ago)
Digit balanced numbers
How many N digit numbers have balanced numbers of digits?

## Input
- A positive integer N.

## Output
- A positive integer M.
- This is the total number of N digit non-negative integers (N digits with no redundant leading zeroes) that have equal numbers of each present digit.

## Examples

### 4 digits
- 1234 has 1 of each present digit, so counts towards the total.
- 1223 has 1 1 and 1 3, but 2 2s, so does not count.
- 1212 has 2 1s and 2 2s, so counts.
- 1000 has 1 1 and 3 0s, so does not count (zeroes are relevant).
- 5555 has 4 5s, so counts.
- 0123 has a leading 0, so is regarded as a 3 digit integer and does not count towards the total for 4 digit integers.

Assessing each 4 digit integer this way gives a total of _______ that have balanced digits.

## Test cases
Test cases are in the format `input : output`.

```text

        TODO

```

## Scoring
This is a [code golf challenge]. Your score is the number of bytes in your code.

> Explanations are optional, but I'm more likely to upvote answers that have one.


[code golf challenge]: https://codegolf.codidact.com/categories/49/tags/4274 "The code-golf tag"