# Bijective Functions Modulo N

**Number Theory**Level 5

For any integer \(n,\) a function \(f:\mathbb{Z} \rightarrow \mathbb{Z}\) is called *bijective modulo \(n\)* if the remainders of \( \{f(0), f(1), \cdots , f(n-1) \} \) upon division by \(n\) are equivalent to \( \{0, 1, \cdots , n-1 \} \) in some order.

A pair of integers \((a,b)\) is called *friends with \(n\)* if the function \(f(x) = ax^3 + bx\) is bijective modulo \(n.\) Find the number of primes \(p < 50\) which satisfy the following property:

- If \((a,b)\) is any pair of integers which is friends with \(p,\) it is friends with \(n\) for infinitely many integers \(n.\)

**Details and assumptions**

As an explicit example, consider the function \(f(x) = 7x\) and take \(n=4.\) We have \[ \{ f(0) , f(1), f(2), f(3) \} = \{0, 7, 14, 21\}.\] Upon division by \(4,\) these numbers leave remainders \( \{0, 3, 2, 1\}\) respectively, which is equivalent to \(\{0, 1, 2, 3\}\) in another order. Thus, \(f(x) = 7x\) is bijective modulo \(n=4.\)

You may refer to a list of primes.

This problem is not entirely original.