6 kyu
Group prime numbers
153NikosAthens
Description:
Write a function generator that will generate the first n
primes grouped in tuples of size m
. If there are not enough primes for the last tuple it will have the remaining values as None
.
Examples
For n = 11 and m = 2:
(2, 3), (5, 7), (11, 13), (17, 19), (23, 29), (31, None)
For n = 11 and m = 3:
(2, 3, 5), (7, 11, 13), (17, 19, 23), (29, 31, None)
For n = 11 and m = 5:
(2, 3, 5, 7, 11), (13, 17, 19, 23, 29), (31, None, None, None, None)
For n = 3 and m = 1:
(2,), (3,), (5,)
Note: large numbers of n
will be tested, up to 50000
Algorithms
Fundamentals
Similar Kata:
Stats:
Created | Jun 12, 2017 |
Published | Jun 12, 2017 |
Warriors Trained | 497 |
Total Skips | 14 |
Total Code Submissions | 653 |
Total Times Completed | 153 |
Python Completions | 153 |
Total Stars | 17 |
% of votes with a positive feedback rating | 91% of 66 |
Total "Very Satisfied" Votes | 56 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 4 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 6 kyu |