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

Stats:

CreatedJun 16, 2019
PublishedJun 18, 2019
Warriors Trained1043
Total Skips261
Total Code Submissions979
Total Times Completed90
Python Completions40
C++ Completions11
JavaScript Completions19
Java Completions6
C Completions9
C# Completions3
Go Completions16
Ruby Completions4
Total Stars1
% of votes with a positive feedback rating79% of 41
Total "Very Satisfied" Votes27
Total "Somewhat Satisfied" Votes11
Total "Not Satisfied" Votes3
Total Rank Assessments43
Average Assessed Rank
5 kyu
Highest Assessed Rank
2 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Dingledooper Avatar
  • lechevalier Avatar
  • kazk Avatar
  • Voile Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
Ad