15
You should write 3 programs and/or functions in one language.
All of these programs should solve the same task but they all should give different (but valid) outputs. (I.e. for every pair of programs their should be some input which generates different (but valid) sets of output numbers.)
The task
- You are given an integer
n
, greater than 1 - You should return or output
n
distinct positive integers, and none of them should be divisible byn
. - The order of the numbers doesn't matter and a permutation of numbers doesn't count as different outputs.
A valid triplet of programs with some input => output
pairs:
program A:
2 => 5 9
4 => 5 6 9 10
5 => 2 4 8 7 1
program B:
2 => 1 11
4 => 6 9 1 2
5 => 4 44 444 4444 44444
program C (differs only in one number from program B):
2 => 1 13
4 => 6 9 1 2
5 => 4 44 444 4444 44444
Scoring
- Your score is the sum of the lengths of the 3 programs or functions.
- Lower score is better.
- If your programs/functions share code, the shared code should be counted into the length of every program that uses the code.
1Does each program have to be able to be run from its own file without any includes, or can the programs depend on some shared module/library that is only counted once? – quintopia – 2015-11-26T19:09:24.900
@quintopia The programs/functions should not share code. If they do, the shared code should be counted into the length of all programs that use the code. – randomra – 2015-11-26T19:13:27.727