Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Don't give me five!

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.

Answer*

Draft saved
Draft discarded
Cancel
3
  • \$\begingroup\$ 05AB1E also has vectorized å, which is , so you can do Ÿ5.å_O for 6 bytes. \$\endgroup\$ Commented Jan 20, 2017 at 11:24
  • \$\begingroup\$ negate meaning -n, or n==0?1:0? \$\endgroup\$ Commented Jan 20, 2017 at 12:38
  • \$\begingroup\$ @ETHproductions: Sorry, that was unclear. I meant logical negation, so n==0?1:0 \$\endgroup\$ Commented Jan 20, 2017 at 12:46

AltStyle によって変換されたページ (->オリジナル) /