The maximum n is 8. There are ten ways to have 8 members of the sum:
2 3 7 11 13 17 19 29
2 3 5 11 13 17 19 31
2 3 5 7 13 19 23 29
2 3 5 7 13 17 23 31
2 3 5 7 11 19 23 31
2 3 5 7 11 17 19 37
2 3 5 7 11 13 29 31
2 3 5 7 11 13 23 37
2 3 5 7 11 13 19 41
2 3 5 7 11 13 17 43
For what it's worth, the smaller such sets are:
101
29 31 41
23 37 41
23 31 47
19 29 53
19 23 59
17 41 43
17 37 47
17 31 53
17 23 61
13 41 47
13 29 59
13 17 71
13 17 19 23 29
11 43 47
11 37 53
11 31 59
11 29 61
11 23 67
11 19 71
11 17 73
11 17 19 23 31
11 13 17 29 31
11 13 17 23 37
11 13 17 19 41
7 41 53
7 23 71
7 13 17 23 41
7 11 83
7 11 23 29 31
7 11 19 23 41
7 11 17 29 37
7 11 17 23 43
7 11 17 19 47
7 11 13 29 41
7 11 13 23 47
7 11 13 17 53
5 43 53
5 37 59
5 29 67
5 23 73
5 17 79
5 17 19 29 31
5 17 19 23 37
5 13 83
5 13 23 29 31
5 13 19 23 41
5 13 17 29 37
5 13 17 23 43
5 13 17 19 47
5 11 19 29 37
5 11 19 23 43
5 11 17 31 37
5 11 13 31 41
5 11 13 29 43
5 11 13 19 53
5 7 89
5 7 23 29 37
5 7 19 29 41
5 7 19 23 47
5 7 17 31 41
5 7 17 29 43
5 7 17 19 53
5 7 13 29 47
5 7 13 23 53
5 7 13 17 59
5 7 11 37 41
5 7 11 31 47
5 7 11 19 59
5 7 11 17 61
5 7 11 13 17 19 29
3 37 61
3 31 67
3 19 79
3 13 19 29 37
3 13 19 23 43
3 13 17 31 37
3 11 19 31 37
3 11 17 29 41
3 11 17 23 47
3 11 13 31 43
3 7 23 31 37
3 7 19 31 41
3 7 19 29 43
3 7 17 31 43
3 7 13 37 41
3 7 13 31 47
3 7 13 19 59
3 7 13 17 61
3 7 11 37 43
3 7 11 19 61
3 7 11 13 67
3 7 11 13 17 19 31
3 5 23 29 41
3 5 19 31 43
3 5 17 29 47
3 5 17 23 53
3 5 13 37 43
3 5 13 19 61
3 5 11 29 53
3 5 11 23 59
3 5 11 13 17 23 29
3 5 7 19 67
3 5 7 13 73
3 5 7 13 19 23 31
3 5 7 13 17 19 37
3 5 7 11 13 19 43
2 23 29 47
2 19 37 43
2 17 29 53
2 17 23 59
2 13 19 67
2 11 41 47
2 11 29 59
2 11 17 71
2 11 17 19 23 29
2 7 31 61
2 7 19 73
2 7 13 79
2 7 13 19 29 31
2 7 13 19 23 37
2 7 13 17 19 43
2 7 11 17 23 41
2 7 11 13 31 37
2 5 41 53
2 5 23 71
2 5 13 17 23 41
2 5 11 83
2 5 11 23 29 31
2 5 11 19 23 41
2 5 11 17 29 37
2 5 11 17 23 43
2 5 11 17 19 47
2 5 11 13 29 41
2 5 11 13 23 47
2 5 11 13 17 53
2 5 7 19 31 37
2 5 7 17 29 41
2 5 7 17 23 47
2 5 7 13 31 43
2 5 7 11 29 47
2 5 7 11 23 53
2 5 7 11 17 59
2 3 43 53
2 3 37 59
2 3 29 67
2 3 23 73
2 3 17 79
2 3 17 19 29 31
2 3 17 19 23 37
2 3 13 83
2 3 13 23 29 31
2 3 13 19 23 41
2 3 13 17 29 37
2 3 13 17 23 43
2 3 13 17 19 47
2 3 11 19 29 37
2 3 11 19 23 43
2 3 11 17 31 37
2 3 11 13 31 41
2 3 11 13 29 43
2 3 11 13 19 53
2 3 7 89
2 3 7 23 29 37
2 3 7 19 29 41
2 3 7 19 23 47
2 3 7 17 31 41
2 3 7 17 29 43
2 3 7 17 19 53
2 3 7 13 29 47
2 3 7 13 23 53
2 3 7 13 17 59
2 3 7 11 37 41
2 3 7 11 31 47
2 3 7 11 19 59
2 3 7 11 17 61
2 3 5 23 31 37
2 3 5 19 31 41
2 3 5 19 29 43
2 3 5 17 31 43
2 3 5 13 37 41
2 3 5 13 31 47
2 3 5 13 19 59
2 3 5 13 17 61
2 3 5 11 37 43
2 3 5 11 19 61
2 3 5 11 13 67
2 3 5 7 41 43
2 3 5 7 37 47
2 3 5 7 31 53
2 3 5 7 23 61
2 3 5 7 17 67
2 3 5 7 13 71
2 3 5 7 11 73
Program (version after finding answer is 8, hence the constant 8, rather than mx for maximum):
clc, clearvars
global set pr
pr=primes(101);
set=[];
addOn(1)
function addOn(wh)
global set pr
if wh<length(pr)
addOn(wh+1)
end
set=[set pr(wh)];
if sum(set) == 101
if length(set)>=8
disp(set)
end
else
if sum(set)<101
if wh<length(pr)
addOn(wh+1)
end
end
end
set=set(1:end-1);
end
|
Posted by Charlie
on 2021-06-16 08:50:43 |