Beta
Prime Number Generator :Intermediate (with inputs) version
Description:
Using ES2015 Generators
Write a prime number generator.
Just Like in the kata Prime Number Generator:Simple version
It should return each prime number in order.
It should start with 2 as the first prime number.
Without timing out it should return up the 10,003rd prime.
Unlike the simple version it should also accept input to the next function so that
primeGen.next(N).value //returns the Nth prime
After that it should return consecutive primes starting at N+1.
primeGen.next(1).value; // returns 2, the 1st prime
primeGen.next().value; // returns 3, the 2nd prime
primeGen.next(100).value; // returns 541, the 100th prime
primeGen.next().value; // returns ???, the 101st prime
if N is not a positive integer than it should behave as if it was called without an argument.
Algorithms
Similar Kata:
Stats:
Created | Jul 31, 2015 |
Published | Jul 31, 2015 |
Warriors Trained | 211 |
Total Skips | 12 |
Total Code Submissions | 325 |
Total Times Completed | 34 |
JavaScript Completions | 34 |
Total Stars | 3 |
% of votes with a positive feedback rating | 93% of 21 |
Total "Very Satisfied" Votes | 19 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 17 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 7 kyu |