Mock AIME 1 2006-2007 Problems/Problem 5
set . Otherwise, set . Compute the sum .
then . If there is no such , then . If , find the sum: .
Note that this really gives a well-defined function because that set includes exactly one member from each congruence class modulo , and each invertible element has inverses in only one such class.
From this point onwards, it's clear: as cycles through , also cycles through the same values in some order. We cover those values 11 times. Thus the answer is .