38
3
Question :
You will be given the starting and ending integers of a sequence and should return the number of integers within it which do not contain the digit 5
. The start and end numbers should be included!
Examples:
1,9 → 1,2,3,4,6,7,8,9 → Result 8
4,17 → 4,6,7,8,9,10,11,12,13,14,16,17 → Result 12
50,60 → 60 → Result 1
-59,-50 → → Result 0
The result may contain five.
The start number will always be smaller than the end number. Both numbers can be also negative!
I'm very curious for your solutions and the way you solve it. Maybe someone of you will find an easy pure mathematics solution.
Edit This is a code-golf challenge, so the shortest code wins.
3@betseq: That´s close; but this one has a variable range (and requires no modulo). – Titus – 2017-01-20T05:42:28.650
4I'd recommend shortest code as winning criterion and the code-golf tag (I didn't even spot that it wasn't!). Also, you should probably should put a test case that spans 50 or 500; also maybe one that spans -50, and one that spans 0 would be a good idea. – Jonathan Allan – 2017-01-20T05:45:40.683
@Qwerp-Derp: Add winning criteria. – Arasuvel – 2017-01-20T05:50:54.857
1@JonathanAllan : I will update examples. – Arasuvel – 2017-01-20T05:51:33.527
4Test case:
50, 59 -> 0
. – Zgarb – 2017-01-20T12:28:30.243Test case: -10 4 – Joshpbarron – 2017-01-20T13:47:55.357
Can the input contain 5? – Digital Trauma – 2017-01-20T16:04:58.430
14You say: "The start number will always be smaller than the end number." but one of your examples (-50,-59) directly contradicts this – theonlygusti – 2017-01-21T10:36:06.020
What about giving a bounty on the most "mathematical" answer that you think? – Matthew Roh – 2017-01-23T09:16:00.840