6 kyu

Group prime numbers

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

More By Author:

Check out these other kata created by NikosAthens

Stats:

CreatedJun 12, 2017
PublishedJun 12, 2017
Warriors Trained497
Total Skips14
Total Code Submissions653
Total Times Completed153
Python Completions153
Total Stars17
% of votes with a positive feedback rating91% of 66
Total "Very Satisfied" Votes56
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes2
Total Rank Assessments4
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • NikosAthens Avatar
  • anter69 Avatar
  • kazk Avatar
  • Blind4Basics Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad