This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

11institutetext: IIT Kanpur

On algorithms to find pp-ordering

Aditya Gulati    Sayak Chakrabarti    Rajat Mittal
Abstract

The concept of pp-ordering for a prime pp was introduced by Manjul Bhargava (in his PhD thesis) to develop a generalized factorial function over an arbitrary subset of integers. This notion of pp-ordering provides a representation of polynomials modulo prime powers, and has been used to prove properties of roots sets modulo prime powers. We focus on the complexity of finding a pp-ordering given a prime pp, an exponent kk and a subset of integers modulo pkp^{k}.

Our first algorithm gives a pp-ordering for set of size nn in time 𝒪~(nklogp)\widetilde{\mathcal{O}}(nk\log p), where set is considered modulo pkp^{k}. The subsets modulo pkp^{k} can be represented succinctly using the notion of representative roots (Panayi, PhD Thesis, 1995; Dwivedi et.al, ISSAC, 2019); a natural question would be, can we find a pp-ordering more efficiently given this succinct representation. Our second algorithm achieves precisely that, we give a pp-ordering in time 𝒪~(d2klogp+nklogp+nd)\widetilde{\mathcal{O}}(d^{2}k\log p+nk\log p+nd), where dd is the size of the succinct representation and nn is the required length of the pp-ordering. Another contribution that we make is to compute the structure of roots sets for prime powers pkp^{k}, when kk is small. The number of root sets have been given in the previous work (Dearden and Metzger, Eur. J. Comb., 1997; Maulick, J. Comb. Theory, Ser. A, 2001), we explicitly describe all the root sets for p2p^{2}, p3p^{3} and p4p^{4}.

Keywords:
root-sets computational complexity pp-ordering polynomials prime powers

1 Introduction

Polynomials over finite fields have played a crucial role in computer science with impact on diverse areas like error correcting codes [BRC60, Hoc59, RS60, Sud97], cryptography [CR01, Odl85, Len91], computational number theory [AL86, AKS04] and computer algebra [Zas69, LLL82]. Mathematicians have studied almost all aspects of these polynomials; factorization of polynomials, roots of a polynomial and polynomials being irreducible or not are some of the natural questions in this area. There is lot of structure over finite field; we can deterministically count roots and find if a polynomials is irreducible in polynomial time [LN97]. Not just that, we also have efficient randomized algorithms for the problem of factorizing polynomials over finite fields [CZ81, Ber70].

The situation changes drastically if we look at rings instead of fields. Focusing our attention on the case of numbers modulo a prime power (ring pk\bbbz_{p^{k}}, for a prime pp and a natural number k2k\geq 2) instead of numbers modulo a prime (field 𝔽p\mathbb{F}_{p}), we don’t even have unique factorization and the fact that the number of roots are bounded by the degree of the polynomial. Still, there has been some interesting work in last few decades. Maulik [Mau01] showed bound on number of roots sets, sets which are roots for a polynomial modulo a prime power. There has been some recent works giving a randomized algorithm for root finding [BLQ13] and a deterministic algorithm for root counting [DMS19, CGRW19].

The concept of pp-ordering and pp-sequences for a prime pp, introduced by Bhargava [Bha97], is an important tool in studying the properties of roots sets and polynomials over powers of prime pp [Mau01, Bha97, Bha09]. Bhargava’s main motivation to introduce pp-ordering was to generalize the concept of factorials (n!n! for n0n\geq 0\in\bbbz) from the set of integers to any subset of integers. He was able to show that many number-theoretic properties of this factorial function (like the product of any kk consecutive non-negative integers is divisible by k!k!) remain preserved even with the generalized definition for a subset of integers [Bha00].

For polynomials, pp-ordering allows us to give a convenient basis for representing polynomials on a subset of ring pk\bbbz_{p^{k}}. One of the interesting problem for polynomials over rings, of the kind pk\bbbz_{p^{k}}, is to find the allowed root sets (Definition 3). Maulik [Mau01] was able to use this representation of polynomials over pk\bbbz_{p^{k}} (from pp-ordering) to give asymptotic estimates on the number of root sets modulo a prime power pkp^{k}; he also gave a recursive formula for root counting.

Our contributions

While a lot of work has been done on studying the properties of pp-orderings [Mau01, Joh09, Bha09], there’s effectively no work on finding the complexity of the problem: given a subset of numbers modulo a prime power, find a pp-ordering. Our main contribution is to look at the computational complexity of finding pp-ordering in different settings. We also classify and count the root-sets for pk\bbbz_{p^{k}}, when k4k\leq 4, by looking at their symmetric structure.

  • pp-ordering for a general set: Suppose, we want to find the pp-ordering of a set SpkS\subseteq\bbbz_{p^{k}}, such that, |S|=n|S|=n. A naive approach, given in Bhargava [Bha97], gives a 𝒪~(n3klog(p))\widetilde{\mathcal{O}}{(n^{3}k\log(p))} time algorithm. We exploit the recursive structure of pp-orderings and optimize the resulting algorithm using data structures. These optimizations allow us to give an algorithm that works in 𝒪~(nklog(p))\widetilde{\mathcal{O}}{(nk\log(p))} time. The details of the algorithm, its correctness and time complexity is given in Section 3.

  • pp-ordering for a subset in representative root representation: A polynomial of degree dd in pk\bbbz_{p^{k}} can have exponentially many roots, but they can have at most dd representative roots [Pan95, DMS19, BLQ13] giving a succinct representation. The natural question is, can we have an efficient algorithm for finding a pp-ordering where the complexity scales according to the number of representative roots and not the size of the complete set. We answer this in affirmative, and provide an algorithm which works in 𝒪~(d2klogp+nklogp+nd)\widetilde{\mathcal{O}}{(d^{2}k\log{p}+nk\log{p}+nd)} time, where dd is the number of representative roots and nn is the length of pp-ordering. The details of this algorithm and its analysis are presented in Section 4.

  • Roots sets for small powers: A polynomial in pk\bbbz_{p^{k}}, even with small degree, can have exponentially large number of roots. But not all subsets of pk\bbbz_{p^{k}} are a root-set for some polynomial. The number of root-sets for the first few values of kk were calculated numerically by Dearden and Metzger [DM97]. Building on previous work, Maulik [Mau01] produced an upper bound on the number of root-sets for any pp and kk. He also gave a recursive formula for the exact number of root-sets using the symmetries in their structure. We look at the structure of these root sets and completely classify all possible root-sets for k4k\leq 4. In Section 5, we discuss and distinctly describe all the root sets in p2\bbbz_{p^{2}}, p3\bbbz_{p^{3}} and p4\bbbz_{p^{4}}.

2 Preliminaries

Our primary goal is to find a pp-ordering of a given set SpkS\subseteq\bbbz_{p^{k}}, for a given prime pp and an integer k>0k>0. Since the input size is polynomial in |S|,logp,k|S|,\log p,k; an efficient algorithm should run in time polynomial in these parameters. For the sake of clarity, logk\log k factors will be ignored from complexity calculations; this omission will be expressed by using notation 𝒪~\widetilde{\mathcal{O}} instead of 𝒪\mathcal{O} in time complexity. We also use [n][n] for the set {0,1,,n1}\{0,1,\dots,n-1\}.

We begin by defining the valuation of an integer modulo a prime pp.

Definition 1.

Let pp be a prime and a0a\neq 0 be an integer. The valuation of the integer aa modulo pp, denoted vp(a)v_{p}(a), is the integer vv such that pvap^{v}\mid a but pv+1ap^{v+1}\nmid a. We also define wp(a):=pvp(a)w_{p}(a):=p^{v_{p}(a)}.

If a=0a=0 then both, vp(a)v_{p}(a) and wp(a)w_{p}(a), are defined to be \infty.

Definition 2.

For any ring SS with the usual operations ++ and \ast, we have

S+a:={x+axS} and aS:={axxS}S+a:=\{x+a\mid x\in S\}\textit{\quad and\quad}a*S:=\{a\ast x\mid x\in S\}
Definition 3.

A given set SS is called a root set in a ring RR if there is a polynomial f(x)R[x]f(x)\in R[x], whose roots in RR are exactly the elements of SS.

Representative Roots:

The notion of representative roots in the ring pk\bbbz_{p^{k}} has been used to concisely represent roots of a polynomial [Pan95, DMS19, BLQ13].

Definition 4.

The representative root (a+pi)(a+p^{i}\ast) is a subset of pk\bbbz_{p^{k}},

a+pi:={a+piyypki1}a+p^{i}\ast:=\{a+p^{i}y\mid y\in\bbbz_{p^{k-i-1}}\}

Extending, a set S={r1,,rl}S=\{r_{1},\cdots,r_{l}\} of representative roots correspond to i=1lripk\bigcup\limits_{i=1}^{l}r_{i}\subseteq\bbbz_{p^{k}}. Conversely, we show that an SpkS\subseteq\bbbz_{p^{k}} can be uniquely represented by representative roots.

Definition 5.

Let SpkS\subseteq\bbbz_{p^{k}}, then the set of representative roots Srep={r1=β1+pk1,r2=β2+pk2,,rl=βl+pkl}S^{\textit{rep}}=\{r_{1}=\beta_{1}+p^{k_{1}}\ast,r_{2}=\beta_{2}+p^{k_{2}}\ast,...,r_{l}=\beta_{l}+p^{k_{l}}\ast\} is said to be a minimal root set representation of SS if

  1. 1.

    S=i=1lriS=\bigcup\limits_{i=1}^{l}r_{i},

  2. 2.

    ri,rjSrep:rirj\nexists~{}r_{i},r_{j}\in S^{\textit{rep}}:r_{i}\subseteq r_{j},

  3. 3.

    i:b[p](ri+pki1b)S\forall i:\bigcup\limits_{b\in[p]}\left(r_{i}+p^{k_{i}-1}\cdot b\right)\nsubseteq S

Theorem 2.1.

Given any set SpkS\subseteq\bbbz_{p^{k}}, the minimal root set representation of SS is unique.

Proof.

For the sake of contradiction, let SrepS^{\textit{rep}} and Srep^\widehat{S^{\textit{rep}}} be two different minimal representations of a set SS. There exists an aSa\in S such that it belongs to both representations, rSrepr\in S^{\textit{rep}} and r^Srep^\widehat{r}\in\widehat{S^{\textit{rep}}} and rr^r\neq\widehat{r}. Then rr can be written as a+pk1a+p^{k_{1}}\ast and r^\widehat{r} can be written as a+pk2a+p^{k_{2}}\ast.

By Observation B.1, rr^r\cap\widehat{r}\neq\emptyset implies rr^r\subset\widehat{r} or r^r\widehat{r}\subset r. Without loss of generality, let r^r\widehat{r}\subset r (equivalently k1<k2k_{1}<k_{2}).

From r^r\widehat{r}\subset r and k1<k2k_{1}<k_{2}, (r^+bpk21)r(\widehat{r}+b\cdot p^{k_{2}-1})\subseteq r for all b[p]b\in[p]. Using rSr\subseteq S, we get

b[p](r^+bpk21)S,\bigcup\limits_{b\in[p]}\left(\widehat{r}+b\cdot p^{k_{2}-1}\right)\subseteq S,

contradicting minimality of Srep^\widehat{S^{\textit{rep}}}.

\blacksquare

pp-ordering and pp-sequence

Bhargava [Bha97] introduced the concept of pp-ordering for any subset of a Dedekind domain, we restrict to the rings of the form pk\bbbz_{p^{k}} [Bha00].

Definition 6 ([Bha97]).

pp-ordering on a subset SS of pk\bbbz_{p^{k}} is defined inductively.

  1. 1.

    Choose any element a0Sa_{0}\in S as the first element of the sequence.

  2. 2.

    Given an ordering a0,a1,ai1a_{0},a_{1},\dots a_{i-1} up to i1i-1, choose aiS\{a0,a1ai1}a_{i}\in S\backslash\{a_{0},a_{1}\dots a_{i-1}\} which minimizes vp((aia0)(aia1)(aiai1))v_{p}((a_{i}-a_{0})(a_{i}-a_{1})\dots(a_{i}-a_{i-1})).

The ii-th element of the associated pp-sequence for a pp-ordering a0,a1,ana_{0},a_{1},\dots a_{n} is defined by

vp(S,i)={0i=0,wp((aia0)(aia1)(aiai1))i>0.v_{p}(S,i)=\begin{cases}0\qquad i=0,\\ w_{p}((a_{i}-a_{0})(a_{i}-a_{1})\dots(a_{i}-a_{i-1}))\qquad i>0.\end{cases}

. In the (i+1)(i+1)-th step, let xS{a0,a1,,ai1}x\in S\setminus\{a_{0},a_{1},...,a_{i-1}\} then the value vp((xa0)(xa1)(xai1))v_{p}((x-a_{0})(x-a_{1})\dots(x-a_{i-1})) is denoted as the pp-value of xx at that step. If the step is clear from context, we call the pp-value of that element at that step as its pp-value.

The pp-ordering on a subset of \bbbz can be defined similarly. Bhargava surprisingly proved the following theorem.

Theorem 2.2 ([Bha97]).

For any two pp-orderings of a subset SS\subseteq\bbbz and a prime pp, the associated pp-sequences are same.

Few observations about pp-orderings/pp-sequences/ representative roots are listed in Appendix B. We also use a min-heap data structure to optimize our algorithm, details of min-heap are given in Appendix C.

3 Algorithm to find p-ordering on a given set

The naive algorithm for finding the pp-ordering, from its definition, has time complexity 𝒪~(n3klog(p))\widetilde{\mathcal{O}}(n^{3}k\log(p)) (Appendix A). The main result of this section is the following theorem.

Theorem 3.1.

Given a set SS\subseteq\bbbz, a prime pp and an integer kk such that each element of SS is less than pkp^{k}, we can find a pp-ordering on this set in 𝒪~(nklogp)\widetilde{\mathcal{O}}(nk\log p) time.

The proof of the theorem follows by constructing an algorithm to find the pp-ordering.

Outline of the algorithm

We use the recursive structure of pp-ordering given by Maulik [Mau01]. Crucially, to find the pp-value of an element aa at each step, we only need to look at elements congruent modp\bmod{p} to aa (Observation B.3).

Suppose SjS_{j} is the set of elements of SS congruent to jmodpj\bmod p. By the observation above, our algorithm constructs the pp-ordering of set SS by merging the pp-ordering of SjS_{j}’s. Given a pp-ordering up to some step, the next element for the pp-ordering of SS is computed by just comparing the first elements in pp-ordering of SjS_{j}’s (not present in the already computed pp-ordering). The pp-ordering of translated SjS_{j}’s is computed recursively (Observation B.4).

While merging the pp-orderings on each of the SiS_{i}’s, at each step we need to extract and remove the element with the minimum pp-value over all SjS_{j}’s and replace it with the next element from the pp-ordering on the same set SjS_{j}. Naively, it would need to find the minimum over all pp number of elements taking 𝒪~(p)\widetilde{\mathcal{O}}{(p)} time. Instead, we use min heap data structure, using only 𝒪~(logp)\widetilde{\mathcal{O}}{(\log p)} time for extraction and insertion of elements.

Each node of the min-heap(HH) consists of the following values,

  1. 1.

    p_valuep\_value: contains pp-value of the element when added to pp-ordering,

  2. 2.

    setset: contains the index of the set S0,S1,,Sp1S_{0},S_{1},...,S_{p-1} element belongs to, and

  3. 3.

    valuevalue: contains the value of the element.

These values are used to preserve the properties of the data structures used. With above intuition in mind, we develop Algorithm 1 to find the pp-ordering on a subset of \bbbz.

Algorithm 1 Find p-ordering
1:procedure Merge(S0,S1,,Sp1S_{0},S_{1},...,S_{p-1})
2:     S[]S\leftarrow[\ ]
3:     for i[0,1,,p1]i\in[0,1,...,p-1] do
4:         for j[0,,len(Si)1]j\in[0,...,len(S_{i})-1] do
5:              Si[j].setiS_{i}[j].set\leftarrow i               
6:     i0,i1,i2,ip1(0,0,,0)i_{0},i_{1},i_{2},...i_{p-1}\leftarrow(0,0,...,0)
7:     HCreate_Min_Heap(node={S0[i0],S1[i1],,Sp1[ip1]},key=p_value)H\leftarrow\textsc{Create\_Min\_Heap($node=\{S_{0}[i_{0}],S_{1}[i_{1}],...,S_{p-1}[i_{p-1}]\},key=p\_value$)}
8:     while H.IsEmpty()!=true do
9:         aExtract_Min(H)a\leftarrow\textsc{Extract\_Min($H$)}
10:         ja.setj\leftarrow a.set
11:         if ij<len(Sj)i_{j}<len(S_{j}) then
12:              ijij+1i_{j}\leftarrow i_{j}+1
13:              Insert(H,Sj[ij]H,S_{j}[i_{j}])          
14:         SaS\leftarrow a      
15:     return SS
16:procedure Find_pp-Ordering(SS)
17:     if length(S)==1 then
18:         S[0].p_value1S[0].p\_value\leftarrow 1
19:         Return SS      
20:     S0,S1,,Sp1([],[],,[])S_{0},S_{1},...,S_{p-1}\leftarrow([\ ],[\ ],...,[\ ])
21:     for iSi\in S do
22:         Si.valuemodp.append(i)S_{i.value\bmod{p}}.append(i)      
23:     for i[0,1,,p1]i\in[0,1,...,p-1] do
24:         SiFind_p-Ordering((Sii)/p)S_{i}\leftarrow\textsc{Find\_$p$-Ordering($(S_{i}-i)/p$)}
25:         for j[0,,len(Si)1]j\in[0,...,len(S_{i})-1] do
26:              Si[j].valuepSi[j].value+iS_{i}[j].value\leftarrow p*S_{i}[j].value+i
27:              Si[j].p_valueSi[j].p_value+jS_{i}[j].p\_value\leftarrow S_{i}[j].p\_value+j               
28:     SMerge(S0,S1,,Sp1)S\leftarrow\textsc{Merge($S_{0},S_{1},...,S_{p-1}$)}
29:     return SS

  In Algorithm 1, we use a sorted list \mathcal{I} of non-empty SiS_{i}’s, and only iterate over \mathcal{I} in steps 3-5, 23-28. Hence, decreasing the time complexities of these loops. We can create/update the list \mathcal{I} in the loop at steps 21-22.

3.1 Proof of Theorem 3.1

To prove the correctness of Algorithm 1, we need two results: Merge() procedure works and valuation is computed correctly in the algorithm.

Theorem 3.2 (Correctness of Merge()).

In Algorithm 1, given SS be a subset of integers, let for k{0,1,,p1}k\in\{0,1,...,p-1\}, Sk={sSsk(modp)}S_{k}=\{s\in S\mid s\equiv k\pmod{p}\}, then given a pp-ordering on each of the SkS_{k}’s, Merge(S0,S1,,Sp1S_{0},S_{1},...,S_{p-1}) gives a valid pp-ordering on SS.

Proof outline.

We start with pp-orderings on each of the non-empty sets (S0,S1,,Sp1)(S_{0},S_{1},...,S_{p-1}), and create a heap taking the first element of each of these pp-ordering. At each successive step, we pick the element in the heap with minimum pp-value to add to the pp-ordering, and insert the next element from the corresponding SjS_{j} to the heap.

We know that the valuation of any element in the combined pp-ordering is going to be equal to their valuation in the pp-ordering over the set SjS_{j} containing them (by Observation B.3). If we show that at each step the element chosen has the least valuation out of all the elements left Merge() works correctly. We prove this by getting a contradiction if any element other than the ones obtained from the min heap is selected by showing the p_value will be greater than what we get from Merge(). \blacksquare

The details of the proof can be found in Appendix D.1. ∎

Theorem 3.3 (Correctness of valuations).

In Algorithm 1, let SS be a subset of integers, then Find_pp-Ordering(SS) gives a valid pp-values for all elements of SS.

Proof outline.

The proof requires two parts: Merge() preserves valuation and changes in the valuation due to translation does not induce errors.

  • To prove that Merge() preserves valuation, we make use of the fact that the combined pp-ordering after merge has the individual pp-orderings as a sub-sequence. Hence, the valuation of each element in the combined pp-ordering is going to be equal to the valuation in the individual pp-ordering (by Observation B.3). Hence, Merge() preserves valuations.

  • We show that the change in valuations due to translation (Step 24) are corrected (Step 27). This is easy to show by just updating the valuation according to Observation B.5.

Hence, valuations are correct maintained throughout the algorithm. \blacksquare

The details of the proof can be found in Appendix D.2. ∎

Using the above two theorems, we prove the correctness of Algorithm 1.

Proof of Theorem 3.1.

For the base case, if SS is a singleton, then the pp-ordering over it is just a single element which is also what Find_pp-Ordering(SS) gives. Let Find_pp-Ordering() works for |S|<k|S|<k, if we show it works for |S|=k|S|=k, then by induction, Find_pp-Ordering() works for sets of arbitrary sizes.

Let |S|=k|S|=k, then when we break the set into S0,S1,,Sp1S_{0},S_{1},...,S_{p-1} (Steps 20-22), either all element belong in a single SiS_{i} or get distributed into multiple sets. We can argue that if all the elements fall into the same group, then when we keep calling recursion (Step 24), after some point set breaks into multiple SiS_{i}’s. Since, by Observation B.4, we know that the pp-ordering on reduced elements is preserved, we’ll get the correct pp-ordering on the original set. Hence, we only need to prove this for the later case.

Since all the element of the set SiS_{i} follow ySi\forall y\in S_{i}, yimodpy\equiv i\bmod{p}, hence ySi\forall y\in S_{i}, p(yi)p\mid(y-i), this implies (Sii)/p(S_{i}-i)/p\subset\bbbz. Hence, Find_pp-Ordering((Sii)/p(S_{i}-i)/p) gives a pp-ordering on (Sii)/p(S_{i}-i)/p with the correct valuations associated with each element (Theorem 3.3).

From Observation B.4, we know that if (a0,a1,)(a_{0},a_{1},...) be a pp-ordering on some set AA, then (pa0+i,pa1+i,)(p*a_{0}+i,p*a_{1}+i,...) be a pp-ordering on pA+ip*A+i. Since, Find_pp-Ordering((Sii)/p(S_{i}-i)/p) is a pp-ordering on (Sii)/p(S_{i}-i)/p, then pFind_p-Ordering((Sii)/p)+xp*\textsc{Find\_$p$-Ordering($(S_{i}-i)/p$)}+x is a pp-ordering on SiS_{i} (Step 26).

Next, since we have valid pp-orderings on S0,S1,,Sp1S_{0},S_{1},...,S_{p-1}, Merge(S0,S1,,Sp1S_{0},S_{1},...,S_{p-1}) returns a valid pp-ordering on SS (Theorem 3.2).

By induction, our algorithm returns a valid pp-ordering on any subset of integers.

If each element of SS is less than pkp^{k}, then pp-ordering on set SS requires 𝒪~(nklogp)\widetilde{\mathcal{O}}(nk\log p) time (Theorem D.1 of Appendix D.3). \blacksquare

4 Algorithm to find pp-ordering on a set of representative roots

The notion of representative roots (Definition 4) allows us to represent an exponentially large subset of pk\bbbz_{p^{k}} succinctly. Further imposing a few simple conditions on this representation, namely the minimal representation (Definition 5), our subset is represented in a unique way (Theorem 2.1). A natural question arises, can we efficiently find a pp-ordering given a set in terms of representative roots?

In this section we show that the answer is affirmative by constructing an efficient algorithm in terms of the size of the succinct representation.

Theorem 4.1.

Given a set SpkS\subset\bbbz_{p^{k}}, for a prime pp and an integer kk, that can be represented in terms of dd representative roots, we can efficiently find a pp-ordering of length nn for SS in 𝒪~(d2klogp+nklogp+np)\widetilde{\mathcal{O}}(d^{2}k\log p+nk\log p+np) time.

The proof of the theorem follows by constructing an algorithm to find the pp-ordering given a set in representative root notation. We can assume that the representative roots are disjoint. If they are not, one representative root will be contained in another (Observation B.1), all such occurrences can be deleted in 𝒪~(d2klogp)\widetilde{\mathcal{O}}(d^{2}k\log p) time.

Outline of the algorithm

The important observation is, we already have a natural pp-ordering defined on a representative root (Observation B.6). Since a pp-ordering on each representative root is already known, we just need to find a way to merge them. Merging was easy in Algorithm 1 because progress in any one of the pp-ordering of an SjS_{j} did not effect the pp-value of an element outside SjS_{j}. However, in this case the exact increase in the pp-value is known by Observation B.2.

Let dd be the number of representative roots, we maintain an array of size dd to keep the valuations that we would get whenever we add the next element from a representative root. To update the ii-th value of this array when an element from the jj-th representative root is added, we simply add the value vp(βiβj)v_{p}(\beta_{i}-\beta_{j})(iji\neq j). Hence, at each step we find the minimum value in this array (in 𝒪~(\widetilde{\mathcal{O}}(d))) and add it to the combined pp-ordering (in 𝒪~(\widetilde{\mathcal{O}}(1))) and we update all the dd values in this array (in 𝒪~(\widetilde{\mathcal{O}}(d))). We repeat this process till we get the pp-ordering of the desired length.

With the above intuition in mind, we develop Algorithm 2 to find the pp-ordering of length nn on a subset SS of pk\bbbz_{p^{k}} given in representative root representation.

Algorithm 2 Find p-ordering from minimal notation
1:procedure Correlate(SS)
2:     Corr[0]len(S)×len(S)Corr\leftarrow[0]_{len(S)\times len(S)}
3:     Corr[0]len(S)×len(S)Corr\leftarrow[0]_{len(S)\times len(S)}
4:     for j[1,,len(S)]j\in[1,...,len(S)] do
5:         for k[1,,len(S)]k\in[1,...,len(S)] do
6:              Corr[j][k]vp(S[j].valueS[k].value)Corr[j][k]\leftarrow v_{p}(S[j].value-S[k].value)               
7:     return CorrCorr
8:procedure pp-Exponent_Increase(nn)
9:     vp(1)1v_{p}(1)\leftarrow 1
10:     for j[1,,n]j\in[1,...,n] do
11:         vp((j+1)!)vp(j+1)vp(j!)v_{p}((j+1)!)\leftarrow v_{p}(j+1)\ast v_{p}(j!)
12:         p_exponent[j]vp((j+1)!)vp(j!)p\_exponent[j]\leftarrow v_{p}((j+1)!)-v_{p}(j!)      
13:     return p_exponentp\_exponent
14:procedure Find_pp-Ordering(S,nS,n)
15:     corrCorrelate(S)corr\leftarrow\textsc{Correlate($S$)}
16:     increasep-Exponent_Increase(n)increase\leftarrow\textsc{$p$-Exponent\_Increase($n$)}
17:     valuations[0]|S|valuations\leftarrow[0]_{|S|}
18:     p_ordering{}p\_ordering\leftarrow\{\}
19:     i1,i2i|S|0i_{1},i_{2}\dots i_{|S|}\leftarrow 0
20:     for i{1,2,n}i\in\{1,2,\dots n\} do
21:         minmin\leftarrow\infty
22:         min_indexmin\_index\leftarrow\infty
23:         for j[1,,len(S)]j\in[1,...,len(S)] do
24:              if valuations[j]<minvaluations[j]<min then
25:                  minvaluations[j]min\leftarrow valuations[j]
26:                  min_indexjmin\_index\leftarrow j                        
27:         p_ordering.append(S[min_index].value+pS[min_index].exponentimin_index)p\_ordering.append(S[min\_index].value+p^{S[min\_index].exponent}\ast i_{min\_index})
28:         for j[1,,len(S)]j\in[1,...,len(S)] do
29:              if j=min_indexj=min\_index then
30:                  valuations[j]valuations[j]+S[min_index].exponentincrease[ij]valuations[j]\leftarrow valuations[j]+S[min\_index].exponent\ast increase[i_{j}]
31:              else
32:                  valuations[j]valuations[j]+corr(min_index,j)valuations[j]\leftarrow valuations[j]+corr(min\_index,j)                        
33:         imin_indeximin_index+1i_{min\_index}\leftarrow i_{min\_index}+1      
34:     return p_orderingp\_ordering

4.1 Proof of Correctness

To prove the correctness of our algorithm, we first prove that valuations are correctly maintained.

Theorem 4.2.

In Algorithm 2, Find_pp-Ordering(S,nS,n) maintains the correct valuations on the set SS of representative roots in valuationsvaluations at every iteration of the loop.

Proof outline.

All elements have 0 valuation at the beginning (Step 17). Also, adding an element from the ii-th representative root increases the valuation of the jj-th representative root by corr(i,j)corr(i,j) (Step 33) for iji\neq j (Observation B.2). The increase for the next element of ii is exponent times the increase in pp-sequence of pk\bbbz_{p^{k}} (Step 30) (Observation B.6). So, we correctly update the valuations array in each iteration. \blacksquare

A detailed proof can be found in Appendix E.1. ∎

Proof of Theorem 4.1.

By the definition of pp-ordering we know that at each iteration if we choose the element with the least valuation then we get a valid pp-ordering. By Theorem 4.2, we know that valuationsvaluations array has the correct next valuations. Hence, to find the representative root with gives the least valuation, we find the index of the minimum element in valuationsvaluations.

To add the next value to the pp-ordering, we use Observation B.6 to find the next element in the pp-ordering on the representative root. Hence, the element added has the least valuation. Hence, Find_pp-Ordering(S,nS,n) returns the correct pp-ordering.

If SS contains dd representative roots of pk\bbbz_{p^{k}}, then Algorithm 2 finds pp-ordering on SS up to length nn in 𝒪~(d2klogp+nklogp+nd)\widetilde{\mathcal{O}}{(d^{2}k\log{p}+nk\log{p}+nd)} time (Theorem E.1 of Appendix E.2). \blacksquare

5 Structure of root sets for a given kk

We know that pk\bbbz_{p^{k}} is not a unique factorization domain. In fact, even small degree polynomials can have exponentially large number of roots. Interestingly, not all subsets of pk\bbbz_{p^{k}} can be a root set (Definition 3). Dearden and Metzger [DM97] showed that RR is a root-set iff Rj={rRrj(modp)}R_{j}=\{r\in R\mid r\equiv j\pmod{p}\} is also a root-set for all j[p]j\in[p]. The size and structure of RjR_{j} is symmetric for all jj. Let NpkN_{p^{k}} be the number of possible RjR_{j}’s, then total number of possible root-sets become (Npk)p(N_{p^{k}})^{p} [DM97]. In this section, we discuss and describe all possible RjR_{j}’s in Zp2Z_{p^{2}}, Zp3Z_{p^{3}} and Zp4Z_{p^{4}}.

Let Sj={spksj(modp)}S_{j}=\{s\in\bbbz_{p^{k}}\mid s\equiv j\pmod{p}\}, we take the following approach to find all possible root-sets RjR_{j}’s. Given an RjR_{j}, define R={(rj)/p:rRj}R=\{(r-j)/p:r\in R_{j}\} to be the translated copy. We show that if RR contains at least kk many distinct residue classes modp\bmod p, then Rj=SjR_{j}=S_{j} (Observation F.1). We exhaustively cover all the other cases, when RR contains less than kk residue classes (possible because kk is small).

5.1 k=2k=2

We find that the root set RjR_{j} can only take the following structures (details in Appendix F.1).

  1. 1.

    𝟏\bm{1} root-set is the complete sub-tree under jj (more than 1 residue class), equivalently

    Rj=j+p.R_{j}=j+p\cdot\ast.
  2. 2.

    𝒑\bm{p} root-sets are a single element congruent to jmodpj\bmod{p} (1 residue class), equivalently

    Rj=j+pα, for α[p].R_{j}=j+p\cdot\alpha\text{, for }\alpha\in[p].
  3. 3.

    𝟏\bm{1} root-set is empty (no residue classes), equivalently

    Rj=.R_{j}=\emptyset.

Hence, total root-sets, Np2=p+2N_{p^{2}}=p+2.

5.2 k=3k=3

Similar to k=2k=2, the root sets RjR_{j} can only take the following structure (details in Appendix F.2).

  1. 1.

    𝟏\bm{1} root-set is the complete sub-tree, equivalently

    Rj=j+p.R_{j}=j+p\cdot\ast.
  2. 2.

    𝒑(𝒑𝟏)𝟐\bm{\frac{p(p-1)}{2}} root-sets are the union of 2 sub-trees different at the level p1p^{1}, equivalently

    Rj=(j+pα1+p2)(j+pα2+p2), for α1α2[p].R_{j}=(j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\in[p].
  3. 3.

    𝒑\bm{p} root-sets are a sub-tree at the level p1p^{1}, equivalently

    Rj=j+pα+p2, for α[p].R_{j}=j+p\cdot\alpha+p^{2}\ast\text{, for }\alpha\in[p].
  4. 4.

    𝒑𝟐\bm{p^{2}} root-sets are a single element congruent to jmodpj\bmod{p}, equivalently

    Rj=j+pα1+p2α2, for α1,α2[p].R_{j}=j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}\text{, for }\alpha_{1},\alpha_{2}\in[p].
  5. 5.

    𝟏\bm{1} root-set is empty, equivalently

    Rj=.R_{j}=\emptyset.

Hence, total root-sets, Np3=3p2+p+42N_{p^{3}}=\frac{3p^{2}+p+4}{2}.

5.3 k=4k=4

Similar to k=2,3k=2,3, the root sets RjR_{j} can only take the following structure (details in Appendix F.3).

  1. 1.

    𝟏\bm{1} root-set is the complete sub-tree under jj, equivalently

    Rj=j+p.R_{j}=j+p\cdot\ast.
  2. 2.

    𝒑(𝒑𝟏)(𝒑𝟐)𝟔\bm{\frac{p(p-1)(p-2)}{6}} root-sets under jj are the union of 3 sub-trees different at the level p1p^{1}, equivalently

    Rj=(j+pα1+p2)(j+pα2+p2)(j+pα3+p2), for α1α2α3[p].R_{j}=(j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\cup(j+p\cdot\alpha_{3}+p^{2}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\neq\alpha_{3}\in[p].
  3. 3.

    𝒑(𝒑𝟏)𝟐\bm{\frac{p(p-1)}{2}} root-sets are the union of 2 sub-trees different at the level p1p^{1}, equivalently

    Rj=(j+pα1+p2)(j+pα2+p2), for α1α2[p].R_{j}=(j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\in[p].
  4. 4.

    𝒑\bm{p} root-sets are a sub-tree at the level p1p^{1}, equivalently

    Rj=j+pα+p2, for α[p].R_{j}=j+p\cdot\alpha+p^{2}\ast\text{, for }\alpha\in[p].
  5. 5.

    𝒑𝟑(𝒑𝟏)𝟐\bm{\frac{p^{3}(p-1)}{2}} root-sets are a union of 2 sub-trees at the level p2p^{2} that are different at the level p1p^{1}, equivalently

    Rj=(j+pα1+p2β1+p3)(j+pα2+p2β2+p3), for α1α2β1,β2[p].R_{j}=(j+p\cdot\alpha_{1}+p^{2}\cdot\beta_{1}+p^{3}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\cdot\beta_{2}+p^{3}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\,\beta_{1},\beta_{2}\in[p].
  6. 6.

    𝒑𝟐\bm{p^{2}} root-sets are a sub-tree at the level p2p^{2}, equivalently

    Rj=j+pα1+p2α2+p3, for α1,α2[p].R_{j}=j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}+p^{3}\cdot\ast\text{, for }\alpha_{1},\alpha_{2}\in[p].
  7. 7.

    𝒑𝟑\bm{p^{3}} root-sets are a single element congruent to jmodpj\bmod{p}, equivalently

    Rj=j+pα1+p2α2+p3α3, for α1,α2,α3[p].R_{j}=j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}+p^{3}\cdot\alpha_{3}\text{, for }\alpha_{1},\alpha_{2},\alpha_{3}\in[p].
  8. 8.

    𝟏\bm{1} root-set is empty, equivalently

    Rj=.R_{j}=\emptyset.

Hence, total root-sets, Np4=3p4+4p3+6p2+5p+126N_{p^{4}}=\frac{3p^{4}+4p^{3}+6p^{2}+5p+12}{6}.

References

  • [AKS04] Manindra Agrawal, Neeraj Kayal, and Nitin Saxena. Primes is in p. Annals of mathematics, pages 781–793, 2004.
  • [AL86] Leonard Adleman and Hendrik Lenstra. Finding irreducible polynomials over finite fields. In Proc. 18th Annual ACM Symp. on Theory of Computing (STOC), 350 - 355 (1986), pages 350–355, 11 1986.
  • [Ber70] E.R. Berlekamp. Factoring polynomials over large finite fields. Mathematics of Computation, 24:713–735, 07 1970.
  • [Bha97] Manjul Bhargava. P-orderings and polynomial functions on arbitrary subsets of dedekind rings. Journal Fur Die Reine Und Angewandte Mathematik - J REINE ANGEW MATH, 1997:101–128, 01 1997.
  • [Bha00] Manjul Bhargava. The factorial function and generalizations. American Mathematical Monthly, 107, 11 2000.
  • [Bha09] Manjul Bhargava. On pp-orderings, rings of integer values functions, and ultrametric analysis. Journal of the American Mathematical Society, 22(4):963–993, 2009.
  • [BLQ13] Jérémy Berthomieu, Grégoire Lecerf, and Guillaume Quintin. Polynomial root finding over local rings and application to error correcting codes. Applicable Algebra in Engineering, Communication and Computing, 24(6):413–443, 2013.
  • [BRC60] R.C. Bose and D.K. Ray-Chaudhuri. On a class of error correcting binary group codes *. Information and Control, 3:68–79, 03 1960.
  • [CGRW19] Qi Cheng, Shuhong Gao, J Maurice Rojas, and Daqing Wan. Counting roots for polynomials modulo prime powers. The Open Book Series, 2(1):191–205, 2019.
  • [CLRS01] T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, Cambridge, MA, 2001.
  • [CR01] Benny Chor and Ronald Rivest. A knapsack type public key cryptosystem based on arithmetic in finite fields. IEEE Transactions on Information Theory, 34, 09 2001.
  • [CZ81] David Cantor and Hans Zassenhaus. A new algorithm for factoring polynomials over finite fields. Mathematics of Computation, 36, 04 1981.
  • [DM97] Bruce Dearden and Jerry Metzger. Roots of polynomials modulo prime powers. Eur. J. Comb., 18:601–606, 08 1997.
  • [DMS19] Ashish Dwivedi, Rajat Mittal, and Nitin Saxena. Efficiently factoring polynomials modulo p4p^{4}. International Symposium on Symbolic and Algebraic Computation, pages 139–146, 07 2019.
  • [Hoc59] A. Hocquenghem. Codes correcteurs d’erreurs. Chiffres, Revue de l’Association Française de Calcul, 2, 01 1959.
  • [Joh09] Keith Johnson. P-orderings of finite subsets of dedekind domains. Journal of Algebraic Combinatorics, 30:233–253, 2009.
  • [Len91] H. Lenstra. On the chor—rivest knapsack cryptosystem. Journal of Cryptology, 3:149–155, 01 1991.
  • [LLL82] Arjen Lenstra, H. Lenstra, and László Lovász. Factoring polynomials with rational coefficients. Mathematische Annalen, 261, 12 1982.
  • [LN97] Rudolf Lidl and Harald Niederreiter. Finite fields, volume 20. Cambridge university press, 1997.
  • [Mau01] Davesh Maulik. Root sets of polynomials modulo prime powers. J. Comb. Theory, Ser. A, 93:125–140, 01 2001.
  • [Odl85] A. Odlyzko. Discrete logarithms and their cryptographic significance. Advances in Cryptography, EUROCRYPT ’84, Proceedings, Lecture Notes in Computer Science, 209:224–314, 1985.
  • [Pan95] Peter N Panayi. Computation of Leopoldt’s P-adic regulator. PhD thesis, University of East Anglia, 1995.
  • [RS60] I. Reed and G. Solomon. Polynomial codes over certain finite fields. Journal of the Society for Industrial and Applied Mathematics, 8:300–304, 06 1960.
  • [Sud97] Madhu Sudan. Decoding reed solomon codes beyond the error-correction bound. Journal of Complexity, 13:180–193, 03 1997.
  • [Zas69] Hans Zassenhaus. On hensel factorization ii. Journal of Number Theory, 1:291–311, 07 1969.

Appendix A Naive Algorithm to find pp-ordering

Given a set of integers SpkS\subseteq\bbbz_{p^{k}} we can find a pp-ordering by naively checking the element which will give us the minimum valuation with respect to pp for the given expression as in Definition 6. After we have already chosen {a0,a1,at1}\{a_{0},a_{1},\dots a_{t-1}\} we choose the next element from S\{a0,a1,at1}S\backslash\{a_{0},a_{1},\dots a_{t-1}\} such that vp((xa0)(xa1)(xat1))v_{p}((x-a_{0})(x-a_{1})\dots(x-a_{t-1})) is minimum. The naive approach given in [Bha97] iterates over all xx in S\{a0,a1,at1}S\backslash\{a_{0},a_{1},\dots a_{t-1}\} and adds the element to the pp-ordering which gives the minimum valuation.

Time Complexity:

Every time we keep on adding another element to the already existing pp-ordering, say of length tt. For any given value of xS\{a0,a1,at1}x\in S\backslash\{a_{0},a_{1},\dots a_{t-1}\}, calculating xaix-a_{i} and multiplying for every 0i<t0\geq i<t takes 𝒪((nt)t)\mathcal{O}((n-t)t) operations in \mathbb{Z} and since each of them are less than pkp^{k} this takes 𝒪((nt)tklogp)𝕆(n2klogp)\mathcal{O}((n-t)tk\log p)\leq\mathbb{O}(n^{2}k\log p). So repeating this nn times gives us the time complexity 𝒪(n3klogp)\mathcal{O}(n^{3}k\log p).

Appendix B Observations about representative roots and pp-sequences/pp-orderings

B.1 Representative roots

Observation B.1.

Given any two representative roots A1=β1+pk1A_{1}=\beta_{1}+p^{k_{1}}\ast and A2=β2+pk2A_{2}=\beta_{2}+p^{k_{2}}\ast, then either A1A2A_{1}\subseteq A_{2} or A2A1A_{2}\subseteq A_{1} or A1A2=A_{1}\cap A_{2}=\emptyset.

Proof.

Let A1=β1+pk1A_{1}=\beta_{1}+p^{k_{1}}\ast and A2=β2+pk2A_{2}=\beta_{2}+p^{k_{2}}\ast be two root sets such that A1A2=A~A_{1}\cap A_{2}=\tilde{A}\neq\emptyset, then we show that A~=A1\tilde{A}=A_{1} or A~=A2\tilde{A}=A_{2}.

Case 1:

Let k1=k2=xk_{1}=k_{2}=x. Let there is some element aA~a\in\tilde{A}. Then aA1a\in A_{1} and aA2a\in A_{2}, hence, A1A_{1} can be defined as A1=a+pxA_{1}=a+p^{x}\ast and similarly A2=a+pxA_{2}=a+p^{x}\ast. Hence, A~=A1=A2\tilde{A}=A_{1}=A_{2}.

Case 2:

Let k1k2k_{1}\neq k_{2}, then without loss of generality, let’s assume that k1<k2k_{1}<k_{2}. Let there is some element aA~a\in\tilde{A}. Then, A1A_{1} can be defined as A1=a+pk1A_{1}=a+p^{k_{1}}\ast and similarly A2=a+pk2A_{2}=a+p^{k_{2}}\ast.

Let bA2b\in A_{2}, then b=a+pk2yb=a+p^{k_{2}}y for some yy. Now, we know that the elements of A1A_{1} are of the form a+pk1a+p^{k_{1}}\ast. Hence, putting =pk2k1y\ast=p^{k_{2}-k_{1}}y, we get a+pk1(pk2k1y)=ba+p^{k_{1}}\cdot(p^{k_{2}-k_{1}}y)=b, hence bA1b\in A_{1}. Hence, A2A1A_{2}\subset A_{1}. Hence, A~=A2\tilde{A}=A_{2}. \blacksquare

Observation B.2.

Let a1β1+pk1a_{1}\in\beta_{1}+p^{k_{1}}\ast and a2β2+pk2a_{2}\in\beta_{2}+p^{k_{2}}\ast be any 2 elements of the representative roots β1+pk1\beta_{1}+p^{k_{1}}\ast and β2+pk2\beta_{2}+p^{k_{2}}\ast respectively, for βα2\beta\neq\alpha_{2}, then,

wp(a1a2)=wp(β1β2).w_{p}(a_{1}-a_{2})=w_{p}(\beta_{1}-\beta_{2}).
Proof.

We have 22 representative roots of the form β1+pk1\beta_{1}+p^{k_{1}}* and β2+pk2\beta_{2}+p^{k_{2}}*. WLOG let us assume that k1k2k_{1}\leq k_{2} and β1pk1,β2pk2\beta_{1}\in\bbbz_{p^{k_{1}}},\beta_{2}\in\bbbz_{p^{k_{2}}}.
We definitely have that these two are different representative roots. So if the first k1k_{1} elements of the pp-adic expansion of β2\beta_{2} are equal then the second representative root will be contained in the first, as the * portion of the first contains all the values of the second representative root as well as its subset. So for them to be different representative roots, pk1β2β1p^{k_{1}}\nmid\beta_{2}-\beta_{1}. Let vp(β1β2)=tv_{p}(\beta_{1}-\beta_{2})=t, t<k1t<k_{1}, then for any value y1,y2y_{1},y_{2} in the respective * sets, we will have pt|(β1+pk1y1)(β2+pk2y2)p^{t}|(\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2}). Note that since k1>vp(β1β2)k_{1}>v_{p}(\beta_{1}-\beta_{2}) we have vp((β1+pk1y1)(β2+pk2y2))vp(β1β2)v_{p}((\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2}))\geq v_{p}(\beta_{1}-\beta_{2}).
Now, since pt|β1β2p^{t}|\beta_{1}-\beta_{2} and pt+1β1β2p^{t+1}\nmid\beta_{1}-\beta_{2} we can write β1β2=pt(a+pb)\beta_{1}-\beta_{2}=p^{t}(a+pb) for a,bpka,b\in\bbbz_{p^{k}} where a{1,2,p1}a\in\{1,2,\dots p-1\}. This implies that if pt+1|(β1+pk1y1)(β2+pk2y2)p^{t+1}|(\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2}), it means pt+1|pt(a+pb)+pk1(y1pk2k2y2)p|a+p()p^{t+1}|p^{t}(a+pb)+p^{k_{1}}(y_{1}-p^{k_{2}-k_{2}}y_{2})\implies p|a+p(\cdots) which can not be true as pap\nmid a. So for any value of y1,y2y_{1},y_{2} in the respective * sets of their corresponding representative roots, we will have vp((β1+pk1y1)(β2+pk2y2))=vp(β1β2)v_{p}((\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2}))=v_{p}(\beta_{1}-\beta_{2}).
Conversely if y1,y2\exists y_{1},y_{2} such that vp((β1+pk1y1)(β2+pk2y2))>vp(β1β2)v_{p}((\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2}))>v_{p}(\beta_{1}-\beta_{2}), let l=vp((β1+pk1y1)(β2+pk2y2))k1l=v_{p}((\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2}))\geq k_{1}. Then we have vp(β1β2)l1v_{p}(\beta_{1}-\beta_{2})\leq l-1. So if pl|(β1+pk1y1)(β2+pk2y2)pl|β1β2p^{l}|(\beta_{1}+p^{k_{1}}y_{1})-(\beta_{2}+p^{k_{2}}y_{2})\implies p^{l}|\beta_{1}-\beta_{2} (as lk1l\leq k_{1}). This is a contradiction as l>vp(β1β2)l>v_{p}(\beta_{1}-\beta_{2}).
This completes the proof of Observation B.2. \blacksquare

B.2 pp-ordering and pp-sequence

Observation B.3 ([Mau01]).

Let SS be a subset of integers, let Sj={sSsj(modp)}S_{j}=\{s\in S\mid s\equiv j\pmod{p}\} for j=0,1,,p1j=0,1,...,p-1, then for any xx\in\bbbz, s.t. xj(modp)x\equiv j\pmod{p},

wp(aiS(xai))=wp(aiSj(xai)).w_{p}\left(\displaystyle\prod_{a_{i}\in S}(x-a_{i})\right)=w_{p}\left(\displaystyle\prod_{a_{i}\in S_{j}}(x-a_{i})\right). (1)
Observation B.4.

Let SS be a subset of integers, let (a0,a1,a2,a_{0},a_{1},a_{2},...) be a pp-ordering on SS, then

  1. 1.

    For any xx\in\bbbz, (a0+x,a1+x,a2+x,a_{0}+x,a_{1}+x,a_{2}+x,...) is a pp-ordering on S+xS+x.

  2. 2.

    For any xx\in\bbbz, (xa0,xa1,xa2,x*a_{0},x*a_{1},x*a_{2},...) is a pp-ordering on xSx*S.

Observation B.5.

Let SS be a subset of integers, let (a0,a1,a2,)(a_{0},a_{1},a_{2},...) be a pp-ordering on SS. Then, for any xx\in\bbbz

  1. 1.

    vp(xS,k)=vp(S,k)+kwp(x)v_{p}(x*S,k)=v_{p}(S,k)+k\cdot w_{p}(x).

  2. 2.

    vp(S+x,k)=vp(S,k)v_{p}(S+x,k)=v_{p}(S,k).

Observation B.6.

Let (a0,a1,)(a_{0},a_{1},...) be a pp-ordering on pk\bbbz_{p^{k}}, then (β+a0pj,β+a1pj,β+a2pj,)(\beta+a_{0}*p^{j},\beta+a_{1}*p^{j},\beta+a_{2}*p^{j},...) is a pp-ordering on β+pj\beta+p^{j}\ast.

Proof.

A simple proof of this theorem follows from Observation B.4 and the fact that 1,2,3,1,2,3,\dots form an obvious pp-ordering in pk\bbbz_{p^{k}}. \blacksquare

Appendix C Min-heap data structure

A min-heap is a data structure in which each node has at most two children and exactly one parent node (except root, no parents). The defining property is that the key value of any node is equal or lesser than the key value of its children.

3571168910

We will use three standard functions on a min-heap with nn nodes [CLRS01].

  1. 1.

    Create_Min_Heap(SS): Takes a set SS as input and returns a min-heap with elements of SS as the nodes in 𝒪~(n)\widetilde{\mathcal{O}}{(n)}.

  2. 2.

    Extract_Min(HH): Removes the element with the minimum key from the heap and rebalances the heap structure in 𝒪~(log(n))\widetilde{\mathcal{O}}{(\log(n))}.

  3. 3.

    Insert(H,aH,a): Inserts the element aa into the heap HH in 𝒪~(log(n))\widetilde{\mathcal{O}}{(\log(n))}.

Appendix D Correctness and Complexity of Algorithm 1

D.1 Proof of Theorem 3.2

Let (a0k,a1k,)(a_{0}^{k},a_{1}^{k},...) be a pp-ordering on each of the SkS_{k}’s. We know that Merge() on (S0,S1,,Sp1)(S_{0},S_{1},...,S_{p-1}) proceeds in such a way that elements are added to the heap in such a way that the element alka_{l}^{k} is added to the heap only after i<l,aik\forall i<l,a_{i}^{k} have already been added to the pp-ordering. Also, we know at any point, only one element from any SkS_{k} can belong to the heap.

We know that at any point, let (a0,a1,ak1)(a_{0},a_{1},...a_{k-1}) be a pp-ordering on SS, then the next element aka_{k} in the pp-ordering on SS if and only if

wp(i{0,1,,k1}(akai))=minxS{a0,a1,ak1}(wp(i{0,1,,k1}(xai))).w_{p}\left(\prod_{i\in\{0,1,...,k-1\}}(a_{k}-a_{i})\right)=\min_{x\in S\setminus\{a_{0},a_{1},...a_{k-1}\}}\left(w_{p}\left(\prod_{i\in\{0,1,...,k-1\}}(x-a_{i})\right)\right).

We know that if at each point, our pick for the next element in the pp-ordering satisfies this condition, the pp-ordering we get is valid.

Lets say (a0,a1,,ai)(a_{0},a_{1},...,a_{i}) be the pp-ordering we have till now. Let elements currently the elements (a0k,a1k,,aik1k)(a_{0}^{k},a_{1}^{k},...,a_{i_{k}-1}^{k}) of the given pp-ordering on set SkS_{k} are currently a part of the pp-ordering. Let the elements (ai00,ai11,,aip1p1)(a_{i_{0}}^{0},a_{i_{1}}^{1},...,a_{i_{p-1}}^{p-1}) are a part of the min-heap.

Let when we extract the min from the min-heap, we get some value aikka_{i_{k}}^{k}. If we show that

wp(j{0,1,,i}(aikkaj))=minxS{a0,a1,ai}(wp(j{0,1,,i}(xaj))),w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right)=\min_{x\in S\setminus\{a_{0},a_{1},...a_{i}\}}\left(w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right)\right),

then we know that aikka_{i_{k}}^{k} is a valid next element in the pp-ordering and hence Merge() gives a correct pp-ordering on SS.

We prove this by contradiction. Let there is an element xS{a0,a1,..,ai,aikk}x\in S\setminus\{a_{0},a_{1},..,a_{i},a_{i_{k}}^{k}\} such that

wp(j{0,1,,i}(xaj))<wp(j{0,1,,i}(aikkaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right)<w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right).

Then, we have 2 cases, either xSkx\in S_{k}, i.e. xkmodpaikkmodpx\equiv k\bmod{p}\equiv a_{i_{k}}^{k}\bmod{p} or xSlx\in S_{l} for some lkl\neq k, i.e. xlmodpaikkmodpx\equiv l\bmod{p}\not\equiv a_{i_{k}}^{k}\bmod{p}.

Case 1: xSkx\in S_{k}

.

Our assumption is that

wp(j{0,1,,i}(xaj))<wp(j{0,1,,i}(aikkaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right)<w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right).

We know that from our assumption that Sk(a0,a1,,ai)=(a0k,a1k,,aik1k)S_{k}\cap(a_{0},a_{1},...,a_{i})=(a_{0}^{k},a_{1}^{k},...,a_{i_{k}-1}^{k}). From Observation B.3,

wp(j{0,1,,i}(aikkaj))=wp(j{0,1,,ik1}(aikkajk)),w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right)=w_{p}\left(\prod_{j\in\{0,1,...,i_{k}-1\}}(a_{i_{k}}^{k}-a_{j}^{k})\right),

and

wp(j{0,1,,i}(xaj))=wp(j{0,1,,ik1}(xajk)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right)=w_{p}\left(\prod_{j\in\{0,1,...,i_{k}-1\}}(x-a_{j}^{k})\right).

Since, (a0k,a1k,,aik1k,aikk,)(a_{0}^{k},a_{1}^{k},...,a_{i_{k}-1}^{k},a_{i_{k}}^{k},...) is a valid pp-ordering on SkS_{k},

wp(j{0,1,,i}(aikkaj))wp(j{0,1,,i}(xaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right)\leq w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right).

But this is a contradiction.

Case 2: xSlx\in S_{l} for some lkl\neq k

.

Our assumption is that

wp(j{0,1,,i}(xaj))<wp(j{0,1,,i}(aikkaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right)<w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right).

Let the element belonging to the set SlS_{l} in the heap is ailla_{i_{l}}^{l}. We know that from our assumption that Sl(a0,a1,,ai)=(a0l,a1l,,ail1l)S_{l}\cap(a_{0},a_{1},...,a_{i})=(a_{0}^{l},a_{1}^{l},...,a_{i_{l}-1}^{l}). From Observation B.3,

wp(j{0,1,,i}(aillaj))=wp(j{0,1,,il1}(aillajl)),w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{l}}^{l}-a_{j})\right)=w_{p}\left(\prod_{j\in\{0,1,...,i_{l}-1\}}(a_{i_{l}}^{l}-a_{j}^{l})\right),

and

wp(j{0,1,,i}(xaj))=wp(j{0,1,,il1}(xajl)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right)=w_{p}\left(\prod_{j\in\{0,1,...,i_{l}-1\}}(x-a_{j}^{l})\right).

Since, (a0l,a1l,,ail1l,aill,)(a_{0}^{l},a_{1}^{l},...,a_{i_{l}-1}^{l},a_{i_{l}}^{l},...) is a valid pp-ordering on SlS_{l},

wp(j{0,1,,i}(aillaj))wp(j{0,1,,i}(xaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{l}}^{l}-a_{j})\right)\leq w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right).

Also, since both ailla_{i_{l}}^{l} and aikka_{i_{k}}^{k} were part of the heap but ExtractMin()ExtractMin() procedure returned aikka_{i_{k}}^{k},

wp(j{0,1,,i}(aikkaj))wp(j{0,1,,i}(aillaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right)\leq w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{l}}^{l}-a_{j})\right).

Using the above two inequalities,

wp(j{0,1,,i}(aikkaj))wp(j{0,1,,i}(xaj)).w_{p}\left(\prod_{j\in\{0,1,...,i\}}(a_{i_{k}}^{k}-a_{j})\right)\leq w_{p}\left(\prod_{j\in\{0,1,...,i\}}(x-a_{j})\right).

But this is a contradiction.

Since, we arrive at a contradiction in both the cases, hence, our assumption must be wrong. Hence,

wp(i{0,1,,k1}(akai))=minxS{a0,a1,ak1}(wp(i{0,1,,k1}(xai))).w_{p}\left(\prod_{i\in\{0,1,...,k-1\}}(a_{k}-a_{i})\right)=\min_{x\in S\setminus\{a_{0},a_{1},...a_{k-1}\}}\left(w_{p}\left(\prod_{i\in\{0,1,...,k-1\}}(x-a_{i})\right)\right).

Hence, our procedure Merge() gives a valid pp-ordering. \blacksquare

D.2 Proof of Theorem 3.3

We prove this by induction on the size of SS.

If SS is a singleton, then the pp-ordering on SS is just that element. And hence the corresponding pp-value is just p0=1p^{0}=1. Find_pp-Ordering(SS) sets this value to 11 in step 18. Hence, our assumption is true for |S|=1|S|=1.

Let our assumption is true for |S|<k|S|<k, if we can show it for |S|=k|S|=k, then by induction, we know our assumption is true for sets of all sizes.

Let |S|=k|S|=k, then when we break this set into smaller S0,S1,,Sp1S_{0},S_{1},...,S_{p-1} (Steps 21-22), either all element belong in a single SiS_{i} or get distributed into multiple sets. We handle the two case separately.

Case 1:

Let SS breaks into smaller S0,S1,,Sp1S_{0},S_{1},...,S_{p-1}.

In this case, we know all the S0,S1,,Sp1S_{0},S_{1},...,S_{p-1} have size less that kk. Hence, the sizes of (Sxx)/p(S_{x}-x)/p is also less than kk for all x{0,1,,p1}x\in\{0,1,...,p-1\}. Hence, we get the correct pp-values for all elements when we call Find_P_Ordering((Sxx)/p)Find\_P\_Ordering((S_{x}-x)/p) in step 24.

From Theorem B.5, we know that vp(Sii,k)=vp((Sii)/p,k)+kv_{p}(S_{i}-i,k)=v_{p}((S_{i}-i)/p,k)+k, hence we add kk to the pp-values of all elements of the output(step 27). We know that vp(Si,k)=vp(Sii,k)v_{p}(S_{i},k)=v_{p}(S_{i}-i,k), hence, the pp-values of each element are correct at the end of step 27.

Next, we show that Merge() preserves the pp-values, we’re done, since we know that Merge() doesn’t update the pp-values of any of the elements. Let an element qq is added at the jthj^{th} position in the pp-ordering output by Merge(). Let all the elements before this element are in the set XX. Then, we know that the pp-value of this element is wp(aiX(qai))w_{p}\left(\displaystyle\prod_{a_{i}\in X}(q-a_{i})\right). By Observation B.3, we know that this is equal to wp(aiXq(modp)(qai))w_{p}\left(\displaystyle\prod_{a_{i}\in X_{q\pmod{p}}}(q-a_{i})\right). Since, merge doesn’t re-order the pp-orderings on any input SxS_{x} while merging, we know that this is exactly the pp-value of qq from before. Hence, Merge() preserves the pp-values.

Hence, the pp-values at the end of Merge() are correct (step 28). Hence, Find_pp-Ordering(SS) gives the correct pp-values.

Case 2:

Let all elements of SS go into a single SiS_{i}.

Since, we recursively keep calling Find_pp-Ordering(\cdot) on the reduced set, we know at some point, we would reach case 1. As proven above, at this point, we would get the correct pp-values. Hence, if we can show that given a correct pp-values in step 24, Find_pp-Ordering(\cdot) outputs the correct pp-values, then by a recursive argument, this would output the correct pp-values for any set of size kk.

Let’s say that all the elements of SS fall into some set SxS_{x}. We assume that Find_pp-Ordering((Sii)/p(S_{i}-i)/p) outputs the correct pp-values, then if we can prove that we get the correct pp-values from SS, then by the above argument, we are done.

From Theorem B.5, we know that vp(Sii,k)=vp((Sii)/p,k)+kv_{p}(S_{i}-i,k)=v_{p}((S_{i}-i)/p,k)+k, hence we add kk to the pp-values of all elements of the output (step 27). We know that vp(Si,k)=vp(Sii,k)v_{p}(S_{i},k)=v_{p}(S_{i}-i,k), hence, the pp-values of each element are correct at the end of step 27.

Since, all the elements in SS are in just one SiS_{i}, Merge() acts as identity. Hence, the output at the end of Step 28 has the correct pp-values. Hence, Find_pp-Ordering(\cdot) gives the correct pp-values for sets of size kk.

Hence, by induction, Find_pp-Ordering(\cdot) outputs the correct pp-values on any subset of integers. \blacksquare

D.3 Time complexity of Algorithm 1

Theorem D.1.

Given a set SS\subset\bbbz of size nn and a prime pp, such that for all elements aSa\in S, a<pka<p^{k} for some kk, Algorithm 1 returns a pp-ordering on SS in 𝒪~(nklogp)\widetilde{\mathcal{O}}(nk\log p) time.

Proof.

We break the complexity analysis into 22 parts, the time complexity for merging the subsets SiS_{i}’s and the time complexity due the to recursive step.

Time complexity of Merge(S0,S1,,Sp1S_{0},S_{1},...,S_{p-1}) in Algorithm 1

Let |S0|+|S1|++|Sp1|=m|S_{0}|+|S_{1}|+...+|S_{p-1}|=m. Then, the time complexity of making the heap (Step 7) is 𝒪~(min(m,p))\widetilde{\mathcal{O}}{(\min(m,p))} (the size of the heap). Next, the construction of common pp-ordering (Steps 8-14) takes 𝒪~(mlogp)\widetilde{\mathcal{O}}{(m\log{p})} time, this is because extraction of an element and addition of an element are both bound by 𝒪~(logp)\widetilde{\mathcal{O}}{(\log{p})} and the runs a total of mm times. Hence, the total time complexity of Merge(S0,S1,,Sp1S_{0},S_{1},...,S_{p-1}) is 𝒪~(min(m,p)+mlogp)=𝒪~(mlogp)\widetilde{\mathcal{O}}{(\min(m,p)+m\log{p})}=\widetilde{\mathcal{O}}{(m\log{p})} time.

Time complexity of Algorithm 1

Let |S|=n|S|=n and SpkS\subset\bbbz_{p^{k}}. Then the recursion depth of Find_pp-Ordering(SS) is bound by kk. Now at each depth, all the elements are distributed into multiple heaps(of sizes m1,m2,,mqm_{1},m_{2},...,m_{q}). Hence, the sum of sizes of all smaller sets at a given depth i=1qmi<n\sum_{i=1}^{q}m_{i}<n. Hence, the time to run any depth is i=1q𝒪~(milogp)=𝒪~(nlogp)\sum_{i=1}^{q}\widetilde{\mathcal{O}}{(m_{i}\log{p})}=\widetilde{\mathcal{O}}{(n\log{p})}. Hence, total time complexity for kk depth is 𝒪~(nklogp)\widetilde{\mathcal{O}}{(nk\log{p})}. \blacksquare

Appendix E Correctness and Complexity of Algorithm 2

E.1 Proof of Theorem 4.2

In this appendix we prove that the valuationsvaluations array from Algorithm 2 maintains the correct valuations.

First we initialize the valuations array to zero, which implies that when we have our pp-ordering as a null set ϕ\phi and add the first element to it, we can select any number according to definition 6.

Suppose we have generated a pp-ordering upto length n~\tilde{n} with i1,i2i|S|i_{1},i_{2}\dots i_{|S|} being the number of elements from each representative root in SS. Now if we add another element to this pp-ordering, from say the jthj^{th} representative root, the pp-value contributed corresponding to each of the representative roots apart from the jthj^{th} one will be vp(βtβj)v_{p}(\beta_{t}-\beta_{j}) where tjt\neq j, according to Observation B.2. Also since we have iti_{t} many elements from each of ttht^{th} representative root, the contribution to pp-value will be itvp(βtβj)i_{t}v_{p}(\beta_{t}-\beta_{j}). Next, we find the pp-value contributed due to the same representative root.

Notice that, from Observation B.6 we will have the elements of the jthj^{th} representative root as a pp-ordering as well on βj+pkj\beta_{j}+p^{k_{j}}*, of length iji_{j}. Now by Theorem B.4, we will have this pp-ordering on βj+pkj\beta_{j}+p^{k_{j}}* as {βj,βj+pkj,βj+pkj2,βj+pkj(ij1)}\{\beta_{j},\beta_{j}+p^{k_{j}},\beta_{j}+p^{k_{j}}2,\dots\beta_{j}+p^{k_{j}}(i_{j}-1)\}. When we add another element to this the pp-value contributed due to jthj^{th} representative root will be kjvp(ij!)k_{j}v_{p}(i_{j}!).

Summing them the total pp-value at each step, considering the next element to be added being from jthj^{th} representative root is t[|S|];tjitvp(βtβj)+kjvp(ij!)\sum_{t\in[|S|];t\neq j}i_{t}v_{p}(\beta_{t}-\beta_{j})+k_{j}v_{p}(i_{j}!). We choose jj such that this expression is minimum in our algorithm.

Now, we want to show that valuations[j]=t[|S|];tjitvp(βtβj)+kjvp(ij!)valuations[j]=\sum_{t\in[|S|];t\neq j}i_{t}v_{p}(\beta_{t}-\beta_{j})+k_{j}v_{p}(i_{j}!). We do this inductively. First we already have 0 stored in each entry of valuationsvaluations. Let, we have obtained a pp-ordering upto length n~\tilde{n} with the respective indices as i1,i2i|S|i_{1},i_{2}\dots i_{|}S| with the pp-value corresponding to addition of next element from jthj^{th} representative root correctly stored in valuations[j]valuations[j]. Next, when we add an element from say the ttht^{th} representative root (t=min_indext=min\_index) we need to change the valuationsvaluations accordingly.

When we add this element we increase iti_{t} by one (it=it+1)(i_{t}^{\prime}=i_{t}+1). Now when we add another element, say mm, (after the last element from the ttht^{th} representative root), if mtm\neq t then the new pp-value will be l[|S|];l{t,m}ilvp(βlβm)+(it+1)vp(βtβm)+kmvp(im!)\sum_{l\in[|S|];l\not\in\{t,m\}}i_{l}v_{p}(\beta_{l}-\beta_{m})+(i_{t}+1)v_{p}(\beta_{t}-\beta_{m})+k_{m}v_{p}(i_{m}!) which is vp(βtβm)v_{p}(\beta_{t}-\beta_{m}) more than the previous valuations[m]valuations[m]. So accordingly we add this value in the previous step (when we find tt as the min_indexmin\_index and then update in Steps 29-30).

However if this mm (the next min_indexmin\_index after adding an element from ttht^{th} representative root) is same as tt, then the pp-value will be l[|S|];ltilvp(βlβt)+ktvp((it+1)!)\sum_{l\in[|S|];l\neq t}i_{l}v_{p}(\beta_{l}-\beta_{t})+k_{t}v_{p}((i_{t}+1)!) while the previous value of valuations[t]valuations[t] was l[|S|];ltilvp(βlβt)+ktvp(it!)\sum_{l\in[|S|];l\neq t}i_{l}v_{p}(\beta_{l}-\beta_{t})+k_{t}v_{p}(i_{t}!) and this difference vp((it+1)!)vp(it!)v_{p}((i_{t}+1)!)-v_{p}(i_{t}!) is stored in pp-Exponent_Increase(iji_{j}). We thereby update Steps 31-32 of Algorithm 2 to incorporate this change. Hence valuationsvaluations correctly stores the pp-value as desired. \blacksquare

E.2 Time complexity of Algorithm 2

Theorem E.1.

Given a set SpkS\subset\bbbz_{p^{k}}, for a prime pp and an integer kk, that can be represented in terms of dd representative roots, Algorithm 2 finds a pp-ordering of length nn for SS in 𝒪~(d2klogp+nklogp+np)\widetilde{\mathcal{O}}(d^{2}k\log p+nk\log p+np) time.

Proof.

Let SS contains dd representative roots of pk\bbbz_{p^{k}} and we want to find the pp-ordering up to length nn, then, Correlate(SS) runs a double loop, each of size dd, and each iteration takes 𝒪~(klogp)\widetilde{\mathcal{O}}{(k\log{p})}, hence, Correlate(SS) takes 𝒪~(d2klogp)\widetilde{\mathcal{O}}{(d^{2}k\log{p})}. pp-Exponent_Increase(nn) runs a single loop of size nn where each iteration takes 𝒪~(klogp)\widetilde{\mathcal{O}}{(k\log{p})} time, hence, it takes 𝒪~(nklogp)\widetilde{\mathcal{O}}{(nk\log{p})}. Then main loop run a loop of size nn, inside this loop we do 𝒪(d)\mathcal{O}(d) operations on elements of size logk\log{k}, hence, it takes 𝒪~(nd)\widetilde{\mathcal{O}}{(nd)} time. Hence, in total, our algorithm takes 𝒪~(d2klogp+nklogp+nd)\widetilde{\mathcal{O}}{(d^{2}k\log{p}+nk\log{p}+nd)} time. \blacksquare

Appendix F Structure of root sets

Observation F.1.

Let f(x)=i=0bixipk[x]f(x)=\sum_{i=0}^{\infty}b_{i}\cdot x^{i}\in\bbbz_{p^{k}}[x], for k<pk<p(kk is small), be a polynomial with root-set AA. Let αijmodp\alpha_{i}\equiv j\bmod{p} for all i[k]i\in[k], be kk numbers such that for no i,ji,j, αiαj0modp2\alpha_{i}-\alpha_{j}\nequiv 0\bmod{p^{2}}. Let αiA\alpha_{i}\in A, for all i[k]i\in[k], then Sj={spksjmodp}AS_{j}=\{s\in\bbbz_{p^{k}}\mid s\equiv j\bmod{p}\}\subseteq A.

Proof.

Let, for all i[k]i\in[k], αl=j+pβl\alpha_{l}=j+p*\beta_{l}, then since αl\alpha_{l} is in the root set of f()f(\cdot), therefore,

f(j+pβl)=i=0bl(j+pβl)i0modpk.f(j+p*\beta_{l})=\sum_{i=0}^{\infty}b_{l}\cdot(j+p*\beta_{l})^{i}\equiv 0\bmod{p^{k}}.

Hence,

i=0k1piβligi(j)0modpk,\sum_{i=0}^{k-1}p^{i}\cdot\beta_{l}^{i}\cdot g_{i}(j)\equiv 0\bmod{p^{k}},

where, gi(x)=n=0(n+in)bn+ixng_{i}(x)=\sum_{n=0}^{\infty}\binom{n+i}{n}\cdot b_{n+i}\cdot x^{n}. Writing this system of equations in the form of matrices BX=0modpkB\cdot X=0\bmod{p^{k}}, we get,

[1β0β0k11β1β1k11βk1βk1k1][g0(j)pg1(j)pk1gk1(j)]=[000]modpk.\begin{bmatrix}1&\beta_{0}&\cdots&\beta_{0}^{k-1}\\ 1&\beta_{1}&\cdots&\beta_{1}^{k-1}\\ \vdots&\vdots&\ddots&\vdots\\ 1&\beta_{k-1}&\cdots&\beta_{k-1}^{k-1}\\ \end{bmatrix}\begin{bmatrix}g_{0}(j)\\ p\cdot g_{1}(j)\\ \vdots\\ p^{k-1}\cdot g_{k-1}(j)\\ \end{bmatrix}=\begin{bmatrix}0\\ 0\\ \vdots\\ 0\\ \end{bmatrix}\bmod{p^{k}}.

Here, |det(B)|=|ij[k](βiβj)||det(B)|=\left\lvert\prod\limits_{i\neq j\in[k]}(\beta_{i}-\beta_{j})\right\rvert. Since βiβj0modp\beta_{i}-\beta_{j}\nequiv 0\bmod{p}, therefore, det(B)0modpdet(B)\nequiv 0\bmod{p}. Hence, BB has an inverse. Multiplying by the inverse on both sides, we get,

[g0(j)pg1(j)pk1gk1(j)]=[000]modpk,or,\begin{bmatrix}g_{0}(j)\\ p\cdot g_{1}(j)\\ \vdots\\ p^{k-1}\cdot g_{k-1}(j)\\ \end{bmatrix}=\begin{bmatrix}0\\ 0\\ \vdots\\ 0\\ \end{bmatrix}\bmod{p^{k}},or,

for i[k]i\in[k], gi(j)0modpkig_{i}(j)\equiv 0\bmod{p^{k-i}}. Hence, for any element j+pβSjj+p\cdot\beta\in S_{j}, f(j+pβ)=i=0k1piβligi(j)0modpkf(j+p*\beta)=\sum_{i=0}^{k-1}p^{i}\cdot\beta_{l}^{i}\cdot g_{i}(j)\equiv 0\bmod{p^{k}} (since pigi(j)0modpkp^{i}\cdot g_{i}(j)\equiv 0\bmod{p^{k}}). Therefore, all elements of SjS_{j} are a root of f()f(\cdot), or SjAS_{j}\subseteq A. \blacksquare

F.1 Structure of root sets in p2\bbbz_{p^{2}}

From Section 5.1, we know if α=α0+α1pp2\alpha=\alpha_{0}+\alpha_{1}\cdot p\in\bbbz_{p^{2}} be a root of some f(x)f(x) in p2\bbbz_{p^{2}}. Then

f(α0)+pα1f(α0)=0modp2.f(\alpha_{0})+p\cdot\alpha_{1}\cdot f^{\prime}(\alpha_{0})=0\bmod{p^{2}}.

Fixing α0\alpha_{0} to some jj, we start looking at structures.

F.1.1 Case 1: root set contains atleast two roots

Let, our root set RjR_{j} contains two distinct roots, say j+α10pj+\alpha_{1}^{0}\cdot p and j+α11pj+\alpha_{1}^{1}\cdot p. Then,

f(j)+pα10f(j)=0modp2,f(j)+p\cdot\alpha_{1}^{0}\cdot f^{\prime}(j)=0\bmod{p^{2}},

and

f(j)+pα11f(j)=0modp2.f(j)+p\cdot\alpha_{1}^{1}\cdot f^{\prime}(j)=0\bmod{p^{2}}.

Solving the above 2 equations, we get

f(j)=0modp2,f(j)=0\bmod{p^{2}},

and

f(j)=0modp.f^{\prime}(j)=0\bmod{p}.

Hence, any j+α~1pj+\tilde{\alpha}_{1}\cdot p, for α~1[p]\tilde{\alpha}_{1}\in[p], is a root of the polynomial, or Rj=j+p.R_{j}=j+p\cdot\ast.

Since, there’s no free variable in RjR_{j}, we just have 11 root-set of this structure.

F.1.2 Case 2: root set contains one root

Let, our root set RjR_{j} contains just one root, say j+α1pj+\alpha_{1}\cdot p. Then,

f(j)+pα1f(j)=0modp2.f(j)+p\cdot\alpha_{1}\cdot f^{\prime}(j)=0\bmod{p^{2}}.

One can easily see that no new roots seep in at this point and a root set of this form is possible111Namely f(x)=x(j+α1p)f(x)=x-(j+\alpha_{1}\cdot p).. Hence, Rj=j+pα1,R_{j}=j+p\cdot\alpha_{1}, for α1[p]\alpha_{1}\in[p].

Since, α1[p]\alpha_{1}\in[p], we just have pp root-sets of this structure.

F.1.3 Case 3: root set is empty

Let our root set is empty.222Namely f(x)=af(x)=a, where a0a\neq 0. Hence, Rj=.R_{j}=\emptyset.

Since, there’s no free variable in RjR_{j}, we just have 11 root-set of this structure.

Therefore, Np2=p+2N_{p_{2}}=p+2. Hence,

Rj={j+p,j+pα, for α[p],.R_{j}=\begin{cases}j+p\cdot\ast\text{,}\\ j+p\cdot\alpha\text{, for }\alpha\in[p]\text{,}\\ \emptyset\text{.}\end{cases}

F.2 Structure of root sets in p3\bbbz_{p^{3}}

From Section 5.2, we know if α=α0+α1p+α2p2p3\alpha=\alpha_{0}+\alpha_{1}\cdot p+\alpha_{2}\cdot p^{2}\in\bbbz_{p^{3}} be a root of some f(x)f(x) in p3\bbbz_{p^{3}}. Then,

f(α0)+pα1f(α0)+((α1)2f′′(α0)2+α2f(α0))p2=0modp3.f(\alpha_{0})+p\cdot\alpha_{1}\cdot f^{\prime}(\alpha_{0})+\left((\alpha_{1})^{2}\cdot\frac{f^{\prime\prime}(\alpha_{0})}{2}+\alpha_{2}\cdot f^{\prime}(\alpha_{0})\right)\cdot p^{2}=0\bmod{p^{3}}.

Fixing α0\alpha_{0} to some jj, we start looking at structures.

F.2.1 Case 1: root set contains atleast three roots different at p1p^{1}

Let, our root set RjR_{j} contains three roots, say j+α10p+α20p2j+\alpha_{1}^{0}\cdot p+\alpha_{2}^{0}\cdot p^{2}, j+α11p+α21p2j+\alpha_{1}^{1}\cdot p+\alpha_{2}^{1}\cdot p^{2} and j+α12p+α22p2j+\alpha_{1}^{2}\cdot p+\alpha_{2}^{2}\cdot p^{2} for α10α11α12\alpha_{1}^{0}\neq\alpha_{1}^{1}\neq\alpha_{1}^{2}. Then, substituting the value and solving the 3 equations, we get

f(j)=0modp3,f(j)=0\bmod{p^{3}},
f(j)=0modp2,f^{\prime}(j)=0\bmod{p^{2}},

and

f′′(j)=0modp.f^{\prime\prime}(j)=0\bmod{p}.

Hence, any j+α~1p+α~2p2j+\tilde{\alpha}_{1}\cdot p+\tilde{\alpha}_{2}\cdot p^{2}, for α~1,α~2[p]\tilde{\alpha}_{1},\tilde{\alpha}_{2}\in[p], is a root of the polynomial, or Rj=j+p.R_{j}=j+p\cdot\ast.

Since, there’s no free variable in RjR_{j}, we just have 11 root-set of this structure.

F.2.2 Case 2: root set contains two roots different at p1p^{1}

Let, our root set RjR_{j} contains three roots, say j+α10p+α20p2j+\alpha_{1}^{0}\cdot p+\alpha_{2}^{0}\cdot p^{2} and j+α11p+α21p2j+\alpha_{1}^{1}\cdot p+\alpha_{2}^{1}\cdot p^{2} for α10α11\alpha_{1}^{0}\neq\alpha_{1}^{1}. Then, substituting the value and solving the 2 equations, we get

f(j)=0modp2,f(j)=0\bmod{p^{2}},

and

f(j)=0modp.f^{\prime}(j)=0\bmod{p}.

Hence, any j+α10p+α~2p2j+\alpha_{1}^{0}\cdot p+\tilde{\alpha}_{2}\cdot p^{2}, for α~2[p]\tilde{\alpha}_{2}\in[p], and j+α11p+α~2p2j+\alpha_{1}^{1}\cdot p+\tilde{\alpha}_{2}\cdot p^{2}, for α~2[p]\tilde{\alpha}_{2}\in[p], is a root of the polynomial, or Rj=(j+pα10+p2)(j+pα11+p2),R_{j}=\left(j+p\cdot\alpha_{1}^{0}+p^{2}\cdot\ast\right)\cup\left(j+p\cdot\alpha_{1}^{1}+p^{2}\cdot\ast\right), for α10α11\alpha_{1}^{0}\neq\alpha_{1}^{1} and α10,α11{0,1,p1}.\alpha_{1}^{0},\alpha_{1}^{1}\in\{0,1,...p-1\}.

Since, α10α11\alpha_{1}^{0}\neq\alpha_{1}^{1} and α10,α11{0,1,p1}\alpha_{1}^{0},\alpha_{1}^{1}\in\{0,1,...p-1\}, we just have p(p1)2\frac{p\cdot(p-1)}{2} root-sets of this structure.

F.2.3 Case 3: root set contains two roots same at p1p^{1}

Let, our root set RjR_{j} contains three roots, say j+α1p+α20p2j+\alpha_{1}\cdot p+\alpha_{2}^{0}\cdot p^{2} and j+α1p+α21p2j+\alpha_{1}\cdot p+\alpha_{2}^{1}\cdot p^{2} for α20α21\alpha_{2}^{0}\neq\alpha_{2}^{1}. Then, substituting the value and solving the 2 equations, we get

f(j)=0modp2,f(j)=0\bmod{p^{2}},

and

f(j)=0modp.f^{\prime}(j)=0\bmod{p}.

Hence, any j+α1p+α~2p2j+\alpha_{1}\cdot p+\tilde{\alpha}_{2}\cdot p^{2}, for α~2[p]\tilde{\alpha}_{2}\in[p], is a root of the polynomial, or Rj=j+pα1+p2,R_{j}=j+p\cdot\alpha_{1}+p^{2}\cdot\ast, for α1,α11{0,1,p1}.\alpha_{1},\alpha_{1}^{1}\in\{0,1,...p-1\}.

Since, α1{0,1,p1}\alpha_{1}\in\{0,1,...p-1\}, we just have pp root-sets of this structure.

F.2.4 Case 4: root set contains one root

Similar to Appendix F.1, we can have just one root α=j+α1p+α2p2\alpha=j+\alpha_{1}\cdot p+\alpha_{2}\cdot p^{2} as a root of f(x)f(x) and no new roots seep in. Hence, Rj=j+pα1+p2α2,R_{j}=j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}, for α1,α2[p]\alpha_{1},\alpha_{2}\in[p].

Since, α1,α2[p]\alpha_{1},\alpha_{2}\in[p], we just have p2p^{2} root-set of this structure.

F.2.5 Case 5: root set is empty

Similar to Appendix F.1, our root set can be empty. Hence, Rj=.R_{j}=\emptyset.

Since, there’s no free variable in RjR_{j}, we just have 11 root-set of this structure.

Therefore, Np3=3p2+p+42N_{p_{3}}=\frac{3p^{2}+p+4}{2}. Hence,

Rj={j+p,(j+pα1+p2)(j+pα2+p2), for α1α2[p],j+pα+p2, for α[p],j+pα1+p2α2, for α1,α2[p],.R_{j}=\begin{cases}j+p\cdot\ast\text{,}\\ (j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\in[p]\text{,}\\ j+p\cdot\alpha+p^{2}\ast\text{, for }\alpha\in[p]\text{,}\\ j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}\text{, for }\alpha_{1},\alpha_{2}\in[p]\text{,}\\ \emptyset\text{.}\end{cases}

F.3 Structure of root sets in p4\bbbz_{p^{4}}

From Section 5.3, we know if α=α0+α1p+α2p2+α3p3p4\alpha=\alpha_{0}+\alpha_{1}\cdot p+\alpha_{2}\cdot p^{2}+\alpha_{3}\cdot p^{3}\in\bbbz_{p^{4}} be a root of some f(x)f(x) in p4\bbbz_{p^{4}}. Then,

f(α0)+pα1f(α0)+((α1)2f′′(α0)2+α2f(α0))p2+((α1)3f′′′(α0)6+2α1α2f′′(α0)+α3f(α0))p3=0modp4.f(\alpha_{0})+p\cdot\alpha_{1}\cdot f^{\prime}(\alpha_{0})+\left((\alpha_{1})^{2}\cdot\frac{f^{\prime\prime}(\alpha_{0})}{2}+\alpha_{2}\cdot f^{\prime}(\alpha_{0})\right)\cdot p^{2}\\ +\left((\alpha_{1})^{3}\cdot\frac{f^{\prime\prime\prime}(\alpha_{0})}{6}+2\cdot\alpha_{1}\cdot\alpha_{2}\cdot f^{\prime\prime}(\alpha_{0})+\alpha_{3}\cdot f^{\prime}(\alpha_{0})\right)\cdot p^{3}=0\bmod{p^{4}}.

Fixing α0\alpha_{0} to some jj, we start looking at structures.

F.3.1 Case 1: root set contains atleast four roots different at p1p^{1}

Let, our root set RjR_{j} contains four roots different at p1p^{1}. Then, substituting the value and solving the 4 equations, we get

f(j)=0modp4,f(j)=0\bmod{p^{4}},
f(j)=0modp3,f^{\prime}(j)=0\bmod{p^{3}},
f′′(j)=0modp2,f^{\prime\prime}(j)=0\bmod{p^{2}},

and

f′′′(j)=0modp.f^{\prime\prime\prime}(j)=0\bmod{p}.

Hence, Rj=j+p.R_{j}=j+p\cdot\ast.

Since, there’s no free variable in RjR_{j}, we just have 11 root-set of this structure.

F.3.2 Case 2: root set contains three roots different at p1p^{1}

Let, our root set RjR_{j} contains three roots different at p1p^{1}. Then, substituting the value and solving the 3 equations, we get

f(j)=0modp3,f(j)=0\bmod{p^{3}},
f(j)=0modp2,f^{\prime}(j)=0\bmod{p^{2}},

and

f′′(j)=0modp.f^{\prime\prime}(j)=0\bmod{p}.

Hence,

Rj=(j+pα1+p2)(j+pα2+p2)(j+pα3+p2)R_{j}=(j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\cup(j+p\cdot\alpha_{3}+p^{2}\ast)

Since, α1α2α3[p]\alpha_{1}\neq\alpha_{2}\neq\alpha_{3}\in[p], we have p(p1)(p2)6\frac{p(p-1)(p-2)}{6} such root sets.

F.3.3 Case 3: root set contains three roots of which 2 are different at p1p^{1} and 2 are different at p2p^{2}

Similar to last case, we get

f(j)=0modp3,f(j)=0\bmod{p^{3}},
f(j)=0modp2,f^{\prime}(j)=0\bmod{p^{2}},

and

f′′(j)=0modp.f^{\prime\prime}(j)=0\bmod{p}.

Hence,

Rj=(j+pα1+p2)(j+pα2+p2)R_{j}=(j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)

Since, α1α2[p]\alpha_{1}\neq\alpha_{2}\in[p], we have p(p1)2\frac{p(p-1)}{2} such root sets.

F.3.4 Case 4: root set contains two roots different at p2p^{2}

Similar to last case, we get

f(j)=0modp3,f(j)=0\bmod{p^{3}},
f(j)=0modp2,f^{\prime}(j)=0\bmod{p^{2}},

and

f′′(j)=0modp.f^{\prime\prime}(j)=0\bmod{p}.

Hence,

Rj=(j+pα1+p2)R_{j}=(j+p\cdot\alpha_{1}+p^{2}\ast)

Since, α1[p]\alpha_{1}\in[p], we have pp such root sets.

F.3.5 Case 5: root set contains two roots different at p1p^{1}

Let, our root set RjR_{j} contains two roots different at p1p^{1}. Then, substituting the value and solving the 2 equations, we get

f(j)=0modp2,f(j)=0\bmod{p^{2}},

and

f(j)=0modp.f^{\prime}(j)=0\bmod{p}.

Hence,

Rj=(j+pα1+p2β1+p3)(j+pα2+p2β2+p3)R_{j}=(j+p\cdot\alpha_{1}+p^{2}\cdot\beta_{1}+p^{3}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\cdot\beta_{2}+p^{3}\ast)

Since, α1,α2,β1,β2[p]\alpha_{1},\alpha_{2},\beta_{1},\beta_{2}\in[p] and α1α2\alpha_{1}\neq\alpha_{2}, we have p3(p1)2\frac{p^{3}(p-1)}{2} such root sets.

F.3.6 Case 6: root set contains two roots different at p3p^{3}

Let, our root set RjR_{j} contains two roots different at p3p^{3}. Then, substituting the value and solving the 2 equations, we get

f(j)=0modp2,f(j)=0\bmod{p^{2}},

and

f(j)=0modp.f^{\prime}(j)=0\bmod{p}.

Hence,

Rj=(j+pα1+p2α2+p3)R_{j}=(j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}+p^{3}\cdot\ast)

Since, α1,α2[p]\alpha_{1},\alpha_{2}\in[p], we have p2p^{2} such root sets.

F.3.7 Case 7: root set is a single element

Similar to the Appendix F.2,

Rj=(j+pα1+p2α2+p3α3)R_{j}=(j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}+p^{3}\cdot\alpha_{3})

Since, α1,α2,α3[p]\alpha_{1},\alpha_{2},\alpha_{3}\in[p], we have p3p^{3} such root sets.

F.3.8 Case 8: root set is a empty

Rj=R_{j}=\emptyset

We have 1 such root set.

Therefore, Np4=3p4+4p3+6p2+5p+126N_{p_{4}}=\frac{3p^{4}+4p^{3}+6p^{2}+5p+12}{6}. Hence,

Rj={j+p,(j+pα1+p2)(j+pα2+p2)(j+pα3+p2), for α1α2α3[p],(j+pα1+p2)(j+pα2+p2), for α1α2[p],j+pα+p2, for α[p],(j+pα1+p2β1+p3)(j+pα2+p2β2+p3), for α1α2β1,β2[p],j+pα1+p2α2+p3, for α1,α2[p],j+pα1+p2α2+p3α3, for α1,α2,α3[p],.R_{j}=\begin{cases}j+p\cdot\ast\text{,}\\ (j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\cup(j+p\cdot\alpha_{3}+p^{2}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\neq\alpha_{3}\in[p]\text{,}\\ (j+p\cdot\alpha_{1}+p^{2}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\in[p]\text{,}\\ j+p\cdot\alpha+p^{2}\ast\text{, for }\alpha\in[p]\text{,}\\ (j+p\cdot\alpha_{1}+p^{2}\cdot\beta_{1}+p^{3}\ast)\cup(j+p\cdot\alpha_{2}+p^{2}\cdot\beta_{2}+p^{3}\ast)\text{, for }\alpha_{1}\neq\alpha_{2}\,\beta_{1},\beta_{2}\in[p]\text{,}\\ j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}+p^{3}\cdot\ast\text{, for }\alpha_{1},\alpha_{2}\in[p]\text{,}\\ j+p\cdot\alpha_{1}+p^{2}\cdot\alpha_{2}+p^{3}\cdot\alpha_{3}\text{, for }\alpha_{1},\alpha_{2},\alpha_{3}\in[p]\text{,}\\ \emptyset\text{.}\end{cases}