How many positive integers cannot be written as 7a + 19b + 28c, where a, b, and c are positive integers (not necessarily distinct)?
clc,clearvars
had=zeros(1,6000);
ct=0;
for a=1:2999
for b=1:2999
for c=1:2999
v=7*a+19*b+28*c;
if v<=3000
had(v)=1;
end
end
end
end
for i=1:3000
if had(i)==0
disp(i)
ct=ct+1;
end
end
ct
There are 107 positive integers unobtainable, as given by the bottom line below:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
55
56
57
58
59
60
62
63
64
65
66
67
69
70
71
72
74
76
77
78
79
81
83
84
85
86
88
90
91
93
95
97
98
100
102
104
105
107
109
112
114
116
119
121
123
126
128
133
135
140
142
147
154
161
ct =
107
|
Posted by Charlie
on 2025-01-07 09:22:44 |