Skip to main content
. 2025 Sep 8;25(17):5602. doi: 10.3390/s25175602
Algorithm 2 Root selection algorithm in the presence of CFO
Initialization: N, K, I, s = 1, Rroot11:I=∅, Rroot21:I=0, Rroot1:2I=∅, g′=1, r = 1, i = 1, j = 1
1: While i≤2I do
2:       if r≥N then g′=g′+1, r = 1, i = 1, j = 1, Rroot11:I=∅, Rroot21:I=0, Rroot1:2I=∅
3:       else
4:            if gcdr,N≠1 or gcdr+sK,N≠1 then r = r + 1
5:            else
6:                    if i=1 then Rroot1j=r, j = j + 1, Rrooti=r, i = i + 1, r = r + 1
7:                     else
8:                            if there exists μ∈Rroot such that gcdN,r−μ>g′ then r = r + 1
9:                            else
10:                                   r2=r, index = 0
11:                                   for k = 1 to j-1 do
12:                                         if Rroot2k=0 then
13:                                         r1=Rroot1k
14:                                                 if QVr1,r2n1≠QVr1,r2n2 for all n1≠n2 (n1, n2∈0,L+1),
15:                                                 and QVr1,r2∩ABr1,r2=∅ then
16:                                                         Rroot2k=r, Rrooti=r, i = i + 1, r = r + 1, index = 1
17:                                                         break
18:                                                 end if
19:                                         end if
20:                                   end for
21:                                   if index = 0 and j≤I then
22:                                   Rroot1j=r, j = j + 1, Rrooti=r, i = i + 1, r = r + 1
23:                                   end if
24:                          end if
25:                  end if
26:          end if
27:     end if
28: end while