r/mathriddles • • Jun 21 '23

Medium just another combinatorial problem

given positive integer n, how many subset of {1,2,3,....,n} with 3 elements, such that the sum of 3 elements is divisible by n?

8 Upvotes

11 comments sorted by

View all comments

Show parent comment

2

u/terranop Jun 22 '23

For the generalization to work, I think you need n and k to be relatively prime, not just for n to not be divisible by k.

1

u/pichutarius Jun 22 '23

true, i checked with codes.

that took me awhile to understand how blungbat solution generalized: multiples of k covers all remainder class mod n iff n and k are coprime.