← Abhinav Gupta

Euler's Totient Function

November 24, 2019

Problem

Given a number N, calculate the count of numbers in {1, 2, 3,…, N} that are relatively prime to N.

Solution

Euler’s Totient Function

Image

Algorithm is as follows-

Reference - geeksforgeeks