Regarding the Jacobi symbol, suppose I want to find which positive odd integers that relatively prime to a prime p such as 13 i.e.

?

=============

I understand that to do composite integers such as

From here, we want (2/p) = (5/p) = 1 or (2/p) = (5/p) = -1.

and

Then by the Chinese Remainder Theorem, then

=============

Similarly, how would you solve for big numbers such as 1040 in the simplest way? i.e. which positive odd integers n such that (1040, n) = 1 and (1040/n) = 1?

Thank you for reading. Any help is greatly appreciated.