What is the sum of all positive integers less than and relatively prime to ?
Bonus : Generalize this for any positive integer
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.
Since 2 7 = 3 3 , therefore exactly those integers will be
coprime to 27, which are not divisible by 3.
Hence, we can get our sum S by applying PIE (the principle of inclusion-exclusion) and the sum of the arithmetic sequence formula:
S = 2 2 7 × ( 1 + 2 7 ) − 3 × 2 9 × ( 1 + 9 ) = 2 4 3
Remark:
For the sake of simplicity, we summed the integers till 27 (despite the question says < 27), but we filtered the 27 out (since it is not coprime to itself), so we got the correct result in the end.