**Claim 4:**The elements [1

^{2}, 2

^{2}, 3

^{2}, ..., ((n-1)/2)

^{2}] mod n when n is the product of two distinct odd primes p and q can be generated using the following relation:

a

_{0}= ((n-1)/2)^{2}mod n
a

_{1}= (a_{0}+ 2*1) mod n
a

_{2}= (a_{1}+ 2*2) mod n
a

_{3}= (a_{3}+ 2*3) mod n
.

.

.

a

_{i}= (a_{i-1}+ 2*i) mod nIf a

_{i}= 0 then all elements [1

^{2}, 2

^{2}, 3

^{2}, ..., ((n-1)/2)

^{2 }mod n] have been generated

**Example:**n = 35 so a

_{0}= ((35-1)/2)

^{2}mod 35 = 9 then

a

_{1}= a

_{0}+ 2*1 mod 35 = 9 + 2 = 11,

a

_{2}= a

_{1}+ 2*2 mod 35 = 11 + 4 = 15,

a

_{3}= 15 + 2*3 mod 35 = 21,

a

_{4}= 21 + 2*4 mod 35 = 29,

a

_{5}= 29 + 2*5 mod 35 = 4,

a

_{6}= 4 + 2*6 mod 35 = 16,

a

_{7}= 16 + 14 mod 35 = 30,

a

_{8}= 30 + 16 mod 35 = 11,

a

_{9}= 11 + 18 mod 35 = 29,

a

_{10}= 29 + 20 mod 35 = 14.

a

_{11}= 14 + 22 mod 35 = 1,

a

_{12}= 1 + 24 mod 35 = 25,

a

_{13}= 25 + 26 mod 35 = 16,

a

_{14}= 16 + 28 mod 35 = 9,

a

_{15}= 9 + 30 mod 35 = 4,

a

_{16}= 4 + 32 mod 35 = 1,

a

_{17}= 1 + 34 mod 35 = 0

**Note:**In this example the set [a

_{0}, a

_{1}, a

_{2}, a

_{3}, ..., a

_{16]}is equivalent to the set [18

^{2}mod 35,19

^{2}mod 35, 20

^{2}mod 35, 21

^{2}mod 35 ..., 34

^{2}mod 35], or the set [17

^{2}mod 35, 16

^{2}mod 35, 15

^{2}mod 35, 14

^{2}mod 35 ..., 1

^{2}mod 35], which is the inverse of the first half of the column at 2 in the exponentiation table of Z

_{35}w. In general, if Corollary 2 described here is true then this is the case for all n in Z where n is the product of two distinct odd primes.

**Claim 5**: There is an element

**< (n-1)/2 in Z**

*a*_{n}where n is the product of two distinct odd primes p and q such that:

*a*^{2 }=

**mod n and**

*a***is**

*a*__either__equal to p or q,

__or__

**a**is a small multiple of p or q

**Example:**

i) n = 35 a = 15 since 15

^{2 }= 15 mod 35
ii) n = 77 a = 22 since 22

^{2 }= 22 mod 35
iii) n = 55 a = 11 since 11

cur = (n-1)/2;

squared = (((n-1)/2)*((n-1)/2))%n;

while( squared != cur && squared != 0)

{

index = index + 1;

squared = (squared + 2*index)%n;

cur = cur - 1;

}

return squared;

}

^{2 }= 11 mod 35
These two claims can be combined in the following function:

a_equal_to_a_squared_mod(n)

{

index = 0;cur = (n-1)/2;

squared = (((n-1)/2)*((n-1)/2))%n;

while( squared != cur && squared != 0)

{

index = index + 1;

squared = (squared + 2*index)%n;

cur = cur - 1;

}

return squared;

}

//WARNING! Writing functions based on unproven claims may lead to restless nights and infinite loops.

The implementation in Javascript of the above function is iFramed below.