Beta
Ludic numbers
40 of 90Dingledooper
Description:
The ludic numbers are a set of numbers related to prime numbers, as they are generated by sieving. Below is the method to generate such numbers.
Generation of ludic numbers:
First take the natural numbers starting from 2.
[2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ...]
1 is the first ludic number -> Ludic = {1}.
Take the first element from the resulting array: 2.
Remove every 2nd indexed number.
[3, 5, 7, 9, 11, 13, 15, 17, 19 ...]
The first deleted number is 2 -> Ludic = {1, 2}.
Take the first element from the resulting array: 3.
Remove every 3rd indexed number.
[5, 7, 11, 13, 17, 19 ...]
The first deleted number is 3 -> Ludic = {1, 2, 3}.
Take the first element from the resulting array: 5.
Remove every 5th number.
[7, 11, 13, 19 ...]
The first deleted number is 5 -> Ludic = {1, 2, 3, 5}.
etc...
Write a function to return an integer: the sum of the first n ludic numbers.
You can assume that 1 ≤ n ≤ 10000.
Sample Tests:
sumLudic(1) -> 1
sumLudic(10) -> 107
sumLudic(25) -> 1100
Algorithms
Similar Kata:
Stats:
Created | Jun 16, 2019 |
Published | Jun 18, 2019 |
Warriors Trained | 1043 |
Total Skips | 261 |
Total Code Submissions | 979 |
Total Times Completed | 90 |
Python Completions | 40 |
C++ Completions | 11 |
JavaScript Completions | 19 |
Java Completions | 6 |
C Completions | 9 |
C# Completions | 3 |
Go Completions | 16 |
Ruby Completions | 4 |
Total Stars | 1 |
% of votes with a positive feedback rating | 79% of 41 |
Total "Very Satisfied" Votes | 27 |
Total "Somewhat Satisfied" Votes | 11 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 43 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 2 kyu |
Lowest Assessed Rank | 7 kyu |