No More 5's, Ever
Description:
Background
This kata is inspired by Don't give me five! Really! by zappa78, which is a step-up from the original Don't give me five by user5036852.
But this one is much harder than both of those. If you're having trouble with this kata, you're recommended to try one of the above.
Problem Description
In this kata, you are required to build a function that receives two arguments, a
and b
, and returns the number of integers between a
and b
inclusive that:
- Do not contain the digit
5
.- The following numbers contain the digit 5:
57
,512
.
- The following numbers contain the digit 5:
- Are not divisible by
5
.- The following numbers are divisible by 5:
100
,420
.
- The following numbers are divisible by 5:
- Do not have exactly
5
digits.- The following numbers have 5 digits:
12345
,32767
.
- The following numbers have 5 digits:
- Are not perfect 5th powers.
- The following numbers are 5th powers:
1
,32
,243
,1024
.
- The following numbers are 5th powers:
Here are the first 10 positive numbers that should be counted: 2
, 3
, 4
, 6
, 7
, 8
, 9
, 11
, 12
, 13
. Negative numbers also count if they are in range.
Input Constraints
Fixed test cases:
-100
≤a, b
≤100
(one hundred)Fixed test cases:
-10^5
≤a, b
≤10^5
(one hundred thousand)Fixed test cases:
-10^10
≤a, b
≤10^10
(ten billion)Fixed test cases:
-10^15
≤a, b
≤10^15
(one quadrillion)
Edge Cases
0
is a multiple of5
and a 5th power.Note that 5th powers can be negative.
If
a
is greater thanb
, return 0.
Stats:
Created | May 18, 2023 |
Published | May 19, 2023 |
Warriors Trained | 918 |
Total Skips | 71 |
Total Code Submissions | 2079 |
Total Times Completed | 69 |
Python Completions | 52 |
JavaScript Completions | 22 |
Total Stars | 49 |
% of votes with a positive feedback rating | 97% of 17 |
Total "Very Satisfied" Votes | 16 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 6 |
Average Assessed Rank | 3 kyu |
Highest Assessed Rank | 2 kyu |
Lowest Assessed Rank | 4 kyu |