**Definition:**Given n, k such that n < k, then k is a

**lonely power**mod n if k to the power of k is congruent to 1 mod n. In other words, if k

^{k}= 1 mod n then k is a lonely power mod n

**Example:**

i) In Z

_{35}there are 5 non-trivial lonely powers mod n, namely 6, 8, 12, 24, 34 since 6

^{6}= 1 mod 35, 8

^{8}= 1 mod 35, 12

^{12}= 1 mod 35, 24

^{24}= 1 mod 35, 34

^{34}= 1 mod 35

ii) In Z

_{15}there are 3 non-trivial lonely powers mod n, namely 4, 8, and 14

iii) In Z

_{11}there are 2 non-trivial lonely powers mod n, namely 5 and 10

iv) In Z

_{25}there is only 1 non-trivial lonely power mod , namely 24

**Note:**Not all lonely squares are lonely powers (for example: 43

^{2}= 1 mod 77 but 43

^{43}= 43 mod 77)

Similarly, not all lonely powers are lonely squares (for example: 8

^{8}= 1 mod 35 but 8

^{2}= 29 mod 35)

**Claim:**If r is the smallest integer such that k

^{r}= 1 mod n and r divides k then k is a lonely power.

**Proof:**Since r divides k then k = r*b for some integer b < k and k

^{r}= 1 mod n so therefore:

k

^{k}= k^{r*b}= (k^{r})^{b}= 1^{b}= 1 mod n ,',

**Definition:**Given k < n, then k is a

**selfie square**mod n if k

^{2}= k mod n

**Example:**

i) In Z

_{35}there are 2 non-trivial selfie squares mod n, namely 15 and 21 since 15

^{2}= 15 mod 35, 21

^{2}= 21 mod 35

ii) In Z

_{15}there are 2 non-trivial selfie squares mod n, namely 6 and 10 since 6

^{2}= 6 mod 15, 10

^{2}= 10 mod 15

iii) In Z

_{11}there are no non-trivial selfies square mod n

iv) In Z

_{25}there are no non-trivial selfies square mod n

I previously discussed selfie squares here but I made a few new observations recently.

**Claim:**If n is the product of two distinct odd primes p and q then there are (at least) 2 non-trivial selfie squares mod n such that if the first non-trivial selfie square k

_{1}is at a distance d from the (((n-1)/2)+1)th element then there exists another selfie square k

_{2}= (((n-1)/2)+1) + d

I edited the algorithm presented in this post to find the second selfie square mod n.

```
/* -------------------------------------------------
This content is released under the GNU License
http://www.gnu.org/copyleft/gpl.html
Author: Marina Ibrishimova
Version: 1.0
Purpose: Find selfie squares in Z
```_{n}
---------------------------------------------------- */
function a_equal_to_a_squared_mod(n)
{
var index = 0;
var cur = (n-1)/2;
var squares = new Array();
var squared =(((n-1)/2)*((n-1)/2))%n;
while( squared != cur && squared != 0)
{
index = index + 1;
squared = (squared + 2*index)%n;
cur = cur - 1;
}
//if there exists one selfie square at
//distance d from (((n-1)/2)+1)th element
cur = ((((n-1)/2)+1) - squared);
//then there exist another one
//at (((n-1)/2)+1) + distance d
cur = (((n-1)/2)+1) + cur;
squares.push(squared);
squares.push(cur);
return squares;
}