Choosing 3 different integers from 1 to 100

How many sets of integers are there, such that 1 a < b < c 100 1 \leq a < b < c \leq 100 and a + b + c a + b + c is a multiple of 3?


The answer is 53922.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Shrihari B
Dec 20, 2014

We can make 3 different sets Set 1 : { 1,4,7,...,100} = 1(mod 3)..... contains 34 elements Set 2 : { 2,5,8,...,98} =2(mod 3)...... contains 33 elements Set 3: {3,6,9,12,...,99} =0(mod 3)...... contains 33 elements

We can choose either all three elements from set 1, 2, 3 or one element from each set. So ways =34C3 + 2 * 33C3 + 34 33 33 =53922

Bill Bell
Aug 25, 2015

Although inelegant as a mathematical solution this is the neatest way I've written code suitable for obtaining explicit solutions to Diophantine-type equations so far. Too bad Python doesn't have macros!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
def Triple():
    a=1
    while True:
        b=a+1
        while True:
            c=b+1
            while True:
                yield (a,b,c)
                c+=1
                if c>100:
                    break
            b+=1
            if b>99:
                break
        a+=1
        if a>98:
            break

count=0
for t in Triple():
    count+=1 if sum(t)%3==0 else 0
print count

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...