7 kyu
Mysterious Singularity Numbers
662 of 1,530mor1nch
Description:
This is a rather simple but interesting kata. Try to solve it using logic. The shortest solution can be fit into one line.
Task
The point is that a natural number N (1 <= N <= 10^9) is given. You need to write a function which finds the number of natural numbers not exceeding N and not divided by any of the numbers [2, 3, 5].
Example
Let's take the number 5 as an example:
- 1 - doesn't divide integer by 2, 3, and 5
- 2 - divides integer by 2
- 3 - divides integer by 3
- 4 - divides integer by 2
- 5 - divides integer by 5
Answer: 1
because only one number doesn't divide integer by any of 2, 3, 5
Note
Again, try to think of a formula that will shorten your solution and help you pass big tests.
Good luck :)
If you want to solve our problems, they are here: From Singularity Hub Community
Fundamentals
Logic
Mathematics
Arrays
Algorithms
Performance
Similar Kata:
Stats:
Created | Mar 9, 2023 |
Published | Mar 9, 2023 |
Warriors Trained | 5333 |
Total Skips | 172 |
Total Code Submissions | 7242 |
Total Times Completed | 1530 |
Python Completions | 662 |
JavaScript Completions | 538 |
C++ Completions | 276 |
TypeScript Completions | 69 |
C Completions | 106 |
CommonLisp Completions | 18 |
RISC-V Completions | 6 |
Total Stars | 100 |
% of votes with a positive feedback rating | 80% of 214 |
Total "Very Satisfied" Votes | 153 |
Total "Somewhat Satisfied" Votes | 37 |
Total "Not Satisfied" Votes | 24 |
Total Rank Assessments | 12 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |