Optimal codes from Fibonacci polynomials and secret sharing schemes

In this work, we study cyclic codes that have generators as Fibonacci polynomials over finite fields. We show that these cyclic codes in most cases produce families of maximum distance separable and optimal codes with interesting properties. We explore these relations and present some examples. Also, we present applications of these codes to secret sharing schemes.

among the elements of C is referred to as the Hamming distance of the code C and it is usually denoted by d(C) or simply d. If C is a linear code over F p with dimension k and minimum distance d, then C is said to be an [n, k, d] p -code. If an error detected while the received word is erroneous, then decoding this word to the closest codeword in C is called the majority decoding method. It is also well known that a linear code with minimum distance d = 2t + 1 or d = 2t + 2 can correct up to t errors. Given the length and the dimension, finding a linear code with best possible minimum distance is an important problem and is an open problem except in a few special cases. An inner product on V of u = (u 1 , u 2 , . . . , u n ), v = (v 1 , v 2 , . . . , v n ) is defined as usual u, v = n i=1 u i v i in F p . Then, we can associate a linear code C ⊥ , called the dual code of C, to a code C by C ⊥ = {v ∈ V | u, v = 0 for all u ∈ C}. If C is a linear code of length n and dimension k, then it is well known that C ⊥ is a linear code of length n and dimension n − k. In literature, cyclic codes from sequences defined over some extension fields with special generators have been studied. Sequences over fields or rings in general have many applications such as left shift registers (LSR), coding, cryptography, etc. [17,20]. This venue of the research is partially accomplished by considering some special sequences. In each case, some special sequences are studied to understand the cyclic codes derived from them. Here, we study the cyclic codes derived from Fibonacci sequences. In the literature there are studies where Fibonacci sequences and codes are related, but to the best knowledge of the authors these studies are in different directions compared to the one presented in this paper. An example of such a study is done by Lee et al. [11] where linear codes related to Fibonacci sequences are presented and burst error correction of such families are studied. There are further studies that are inspired by Fibonacci sequences [7,10]. In the sequel, we present some basic properties of both Fibonacci sequences and error-correcting codes. In the next section, we relate Fibonacci sequences with cyclic codes and we study the properties of such codes. Moreover, we apply these families of codes to construction of secret sharing schemes.

Fibonacci sequences and some properties
In this subsection, we present some basic properties and theorems regarding Fibonacci sequences that will be useful in the following sections. Definition 1.1 Let F 0 = 0 and F 1 = 1 be elements of a finite field F p . Then, the sequence defined by F n = F n−1 + F n−2 for n ≥ 2 is called the Fibonacci sequence in F p . If we take the first two terms of the sequence as F 0 = a and F 1 = b, then the sequence is called generalized Fibonacci sequence and we will denote generalized Fibonacci sequence byḠ (a, b).

Definition 1.2
The smallest t > 0 such that F 0 ≡ F t mod p and F 1 ≡ F t+1 mod p, where F t is the tth Fibonacci number, is called Pisano period of p and we denote this period by l p .
There has not been established a direct formula for computing l p yet. However, the following theorem gives a restriction for possible values of l p . Theorem 1.4 [22] Let l p denote the period of the Fibonacci sequence modulo p. Then, 1. If p is prime and p ≡ ±1 mod 10, then l p | p − 1. 2. If p is prime and p ≡ ±3 mod 10, then l p |2( p + 1). Lemma 1.5 [5] 5 is a quadratic residue modulo primes of the form 5t ± 1 and a quadratic non-residue modulo primes of the form 5t ± 2. Lemma 1.6 [21] If a prime p is of the form 5t ± 1, then F p−1 ≡ 0 and F p ≡ 1 mod p. If a prime p is of the form 5t ± 2, then F p ≡ −1 and F p+1 ≡ 0 mod p. Table 1 The table indicates the connection between Pisano period (l p ), the index of the first term of the Fibonacci sequence which is zero (α ( p)), the least residue of sequence (s ( p)), and the number of zeros in a single period of Fibonacci sequence computed in F p (or equivalently the order of s ( p) , (β ( p)) modulo prime p) The corresponding Fibonacci sequence   7  1 6  8  6  2  {0, 1, 1, 2, 3, 5, 1, 6, 0, 6, 6, 5, 4, 2, 6, 1}  11  10  10  1  Let α ( p) denote the index of the subscript of the first nonzero term of the Fibonacci sequence which is divisible by p. Let s ( p) be the least residue of F α( p)+1 mod p and let β ( p) denote the order of s ( p) modulo p, i.e., the smallest positive integer β ( p) such that s ( p) β( p) ≡ 1 mod p. See Table 1 for numerical examples of α( p), β( p) and s( p).
As a result of Theorem 1.7, β ( p) can be considered as the number of zeros in a single period of Fibonacci sequence computed in F p .

Error-correcting code basics
In this subsection, we present some basic theory about linear codes especially cyclic codes. For further and more detailed information regarding this topic the readers may refer to [13]. Let F p be a finite field with p elements where p is prime and F n p be an n dimensional vector space. A linear code C of length n over F p is a subspace of F n p . A subset S of F n p is cyclic if (a n−1 , a 0 , a 1 , . . . , a n−2 ) ∈ S whenever (a 0 , a 1 , . . . , a n−1 ) ∈ S.
A linear code C is called a cyclic code if C is also a cyclic set. Definition 1.10 [13] Let α be a primitive element of F p m and denote by M (i) (x) the minimal polynomial of α i with respect to F p . A (primitive) BC H code over F p of length n = p m − 1 with designed distance δ is a p-ary cyclic code generated by for some integer a. Furthermore, the code is called narrow-sense if a = 1. [13] A p-ary Reed Solomon code (RS code) is a p-ary BC H code of length p − 1 generated by

Definition 1.11
To relate the combinatorial structure of cyclic codes with algebraic structures, the following map ϕ is defined as . , a n−2 , a n−1 ) = a 0 + a 1 x + · · · + a n−2 x n−2 + a n−1 x n−1 . (1) is a principal ideal rings and ϕ corresponds each subspace of F n p to an ideal in F p [x]/(x n − 1). The following theorem states this connection: Theorem 1.12 [13] Let ϕ be the linear map defined in Eq. (1). Then a nonempty subset C of F n p is a cyclic code if and only if ϕ(C) is an ideal of F p [x]/(x n − 1). Corollary 1.13 [13] The nonempty subset C of F n p is a cyclic code of length n if and only if g(x)|x n − 1 and ϕ(C) = g(x) . Example 1.14 The code C = {000, 111, 222} is a ternary cyclic code. The corresponding ideal in Since the minimum distance determines the error correction and detection capability of a code, it is an important parameter for codes, and also determining it is a very difficult problem. There are at least some bounds that help estimate the minimum distance of a code. Now, we present definitions and theorems regarding some special bounds that will be referred in the sequel. Definition 1.15 [13] (Singleton bound) If C is a linear code with parameters [n, k, d], then k ≤ n − d + 1.
Definition 1.16 [13] A linear code with parameters [n, k, d] such that k + d = n + 1 is called a maximum distance separable (MDS) code.
The code presented in Example 1.14 is MDS.

Theorem 1.17 (Griesmer Bound) [13] Let C be a p-ary code of parameters
Here, if α is a real number, then α denotes the smallest integer larger or equal to (the ceil) α.

Cyclic codes obtained from Fibonacci polynomials
In this section, we study the cyclic codes that are generated by polynomials related to Fibonacci sequences. Definition 2.1 [8] Let S = {s 0 , s 1 , . . .} be an arbitrary sequence over F p . Assume that s i+n + c n−1 s i+n−1 + · · · + c 0 s i = 0 for some elements c 0 , c 1 , . . . , c n−1 ∈ F p and for all i = 0, 1, . . . . Then the polynomial x n + c n−1 x n−1 + · · · + c 1 x + c 0 is called the characteristic polynomial of S. A characteristic polynomial of minimal degree is called the minimal polynomial of S. .
. .} denote the Fibonacci sequence over F p and suppose that the period of this sequence is equal to l.
be the Fibonacci polynomial with period l = p − 1 and β ( p) = 1. Then, Proof 1. By direct checking and applying the properties of Fibonacci sequence we see that be the cyclic code of length p−1 generated by g(x) and dimension p − 1 − deg(g(x))) = 2. This code has exactly p 2 codewords. Since ). Since the number of zeros in a single period of a given Fibonacci sequence is only one, then we have w(g(x)) = p − 2. Also, w(xg(x)) = p − 2 for which xg(x) ∈ C. The codeword g(x) has the zero entry in its first coordinate and xg(x) has the zero entry in its second coordinate. Suppose that a codeword c(x) ∈ C has two entries with zeros. Then, g(x), xg(x), c(x) will give a linearly independent subset of vectors in C which is a contradiction to the dimension 2 of C. 3. Follows from previous part and Definition 1.16.

Corollary 2.3
The codes given in Theorem 2.2 are R S codes.
Proof Clearly, the length of C ⊥ is p − 1. Let us now determine the dimension and minimum distance of C ⊥ .
Lemma 2.8 Let F n be a Fibonacci sequence with period l over F p .Then, there are l−β( p) β( p) − 1 non-zero, non-multiple and different, two consecutive terms in a sequence.
Proof We know that there are l − β ( p) nonzero terms in a sequence and if we obtain zero term in a sequence, then the length of subsequent terms until another zero term must be a multiple of the preceding part of the sequence. So there are l−β( p) β( p) − 1 non-zero, non-multiple and different, two consecutive terms in a sequence.

Theorem 2.9
The cyclic codes given in Theorems 2.2, 2.6 and Corollary 2.5 are constant one or two weight codes.
Proof Since the dimension of the given codes are 2, the generator matrix is of the form Thus, we can generate in total p 2 codewords from the generator matrix G where clearly one of them is all the zero vector. The number of nonzero coefficients of f (x) is the same as with x f (x) and the weight of these codewords are l − β ( p) . So, from the rows of generator matrix G, we can obtain 2 ( p − 1) codewords of weight l − β ( p) . Also, generalized Fibonacci sequences (for details see [9]) satisfy the following facts.
1. If we start with any two consecutive Fibonacci numbers for a and b,Ḡ(a, b, i) will be essentially the same as the Fibonacci sequence but with its indices changed. The general rule is 2. Multiplying all the terms by k gives the same sequence as the one with starting values ka and kb Eq.
(2) says that if we start with any two consecutive Fibonacci numbers, then we obtain codewords whose weights are the same with the codewords of the form f (x). By Lemma 2.8, there are l−β( p) β( p) − 1 non-zero, non-multiple and different, two consecutive terms in a Fibonacci sequence mod p. Also from Eq. (3), there are p − 1 multiples of each non-zero two consecutive terms. Then, we have l−β( p) β( p) − 1 ( p − 1) codewords which have the same weight with f (x). Therefore, the total number of codewords of weight l − β ( p) is . Since the minimum weight of the codes given in Theorems 2.2, 2.6 and Corollary 2.5 are d = l − β ( p), the other weights of the codewords must be l, because every Fibonacci sequence mod p has β ( p) parts and all these parts have the same weight. Thus, the number of codewords of weight l are

Corollary 2.10
Let A w denote the number of codewords with Hamming weight w in the codes given in Theorems 2.2, 2.6 and Corollary 2.5. Then the weight distribution of these codes is given in Tables 2, 3 and 4.

Cyclic codes from generalized Fibonacci polynomials
If we take F 0 = 2 and F 1 = 1 as initial values for the Fibonacci sequence, then we obtain the well-known Lucas sequence. A natural problem then is to figure out the structure of cyclic codes if they are defined in a more general setting, with general initial values, which is known as generalized Fibonacci sequences. Let f (x) be a generalized Fibonacci polynomial with F 0 = a and F 1 = b. Then, If we consider this polynomial as the generator polynomial of a cyclic code, as generator polynomial of an ideal in F p [x]/(x p−1 − 1), then this means that    Hence, if a = 0, then a is a unit in the ring So, the only cases to get a nontrivial cyclic code from generalized Fibonacci polynomials are the cases where a = 0. When a = 0, all cyclic codes (ideals) are the same. So the Fibonacci polynomial codes are the only interesting ones among this family that we have already studied above.

Cyclic codes from extended Fibonacci polynomials
Let E 0 = 0 and E 1 = · · · = E r −1 = 1 be elements of a finite field F p . Then, the sequence defined by E n = n−1 j=n−r E j for n ≥ r is called the extended Fibonacci sequence in F p . For example, for r = 3 the extended Fibonacci sequence computed in F 3 (for examples over F 7 and F 13 see Table 5)

Secret sharing schemes from codes
Secret sharing system is a method of projecting a secret data to finitely many participants with the aim that a designed number of or designed participants can recover the data. In this system, a secret data s is divided into shares and distributed to participants from the set P = {P 1 , P 2 , . . . , P n−1 } in such a way that only authorized subsets of P can reconstruct the secret, whereas unauthorized subsets cannot reconstruct the secret. There are several secret sharing systems in literature [3,4,16,19]. One of them is based on coding theory. In 1993, Massey has shown that every linear code can be used to construct the secret sharing scheme [15]. Let us now recall the system given by Massey. Let C be an [n, k, d] linear code over finite field F p and G = [g 0 , g 1 , . . . , g n−1 ] be a generator matrix of C where g i 's are the column vectors of G. In this system, column vectors of G are nonzero. Dealer, who is a person building the system, randomly chooses a vector from u = (u 0 , u 1 , . . . , u k−1 ) ∈ F k p to generate the codeword uG = (v 0 , v 1 , . . . , v n−1 ). The dealer picks the first coordinate of a codeword as a secret, i.e., s = v 0 = ug 0 , and distributes v i to participants P i as a share for 1 ≤ i ≤ n − 1 . Since s = v 0 = ug 0 , it is easily seen that the set of shares {v i 1 , v i 2 , . . . , v i t } determines the secret s if and only if g 0 is a linear combination of g i 1 , g i 2 , . . . , g i t . To recover the secret s, firstly the linear equation g 0 = t j=1 x j g i j is solved and x j is found, then the secret is computed by Definition 3.1 [15] Let v be a vector of length n over F p . The support of v is defined as We say that a vector v 2 covers a vector v 1 if the support of vector v 2 contains that of v 1 i.e., supp(v 1 ) ⊆ supp(v 2 ). Definition 3.2 [15] A nonzero vector c is called minimal if it only covers its scalar multiples. If the first component of minimal vector c is 1, then the vector c is called minimal codeword. Definition 3.3 [12] The family of all authorized subsets of P is called access structure of the scheme. Authorized subsets of P are called minimal access sets if they can reconstruct the secret s, but any of its proper subsets cannot reconstruct the secret s.
Hence, we have the following main lemma: Lemma 3.4 [15] Let C be an [n, k, d] linear code over finite field F p and C ⊥ be the dual code of C. In the secret sharing scheme based on C, a set of shares {v i 1 , v i 2 , . . . , v i t } recovers the secret s if and only if there is a codeword in C ⊥ such that (1, 0, . . . , 0, c i 1 , 0, . . . , c i t , 0, . . . , 0) where c i j = 0 for at least one j, 1 ≤ i 1 < · · · < i m ≤ n − 1 and 1 ≤ m ≤ n − 1.
From Lemma 3.4, it is clear that there is a one to one correspondence between the set of minimal access sets and sets of minimal codewords. But, it is very hard to find the minimal codewords of linear codes in general.

Access structures from Fibonacci codes
In this section, we consider the secret sharing schemes obtained from Fibonacci codes whose minimal codewords can be characterized. Let us remind two lemmas in the literature which state the main results of how to determine the access structure. Lemma 3.5 [1,2] Let C be an [n, k, d] code over F p . Let w min , w max be a minimum and maximum nonzero weight of C, respectively. If then each nonzero codeword of C is a minimal vector.
Lemma 3.5 states that if the weights of a linear code are close enough to each other, then each nonzero codeword of the code is minimal. The following lemma characterizes the minimal access set of C where each nonzero codeword is a minimal vector. Proof The codes of parameters [2 p + 2, 2, 2 p] are one weight codes and by Lemma 3.5 all codewords of such codes are minimal. Thus, from Lemma 3.6 there are p 2−1 = p minimal access sets. Also, from the Fibonacci sequence mod p and β ( p) = 2, we have two multiple parts in a sequence. So, the g p+1 column is a multiple of g 0 . This means that P p+1 is a dictatorial participant. The other remaining participants are involved in ( p − 1) p 2−2 = ( p − 1) minimal access sets.
Example 3.8 The code C given in Example 2.15 has parameters [16,2,14] with the following weight distribution: In the secret sharing scheme based on the dual code of C, the number of minimal access sets are 7, and the list of all these minimal access sets are as follows: Proof From Table 2, it is easily seen that the codewords of weight p − 2 whose first component 1 are minimal codewords. We have in total p 2 p = p codewords whose first component is 1. We should remove full weight codes whose first component is 1, to get minimality. There are 2 ( p − 1) codewords which have weight p − 1. So, there are 2( p−1) p−1 = 2 codewords whose first component is 1. This gives us the total number of the codewords of weight p − 2, whose first component is 1. Consequently, we have p − 2 minimal codewords. Therefore, there are p − 2 minimal access sets. Second part of proof If we fix i, 1 ≤ i ≤ p − 2, participant P i is involved in p − 2 minimal access sets. In this case, we can choose the remaining participants to recover the key in p − 3 p − 4 = p − 3 ways. This is a contradiction to p − 2 minimal access sets. Thus each of participant P i is involved in ( p − 3) minimal access sets.
We only state and skip the proofs of the following corollaries since they can be proved similarly as in Theorems 3.7 and 3.9.   13 For β ( p) = 1 and l = p − 1, we have a linear code of parameters [10,2,9] 11 given in Example 2.13. From Theorem 3.9, there are p − 2 = 9 minimal access sets and the list of all these minimal access sets are as follows: In this example, each participant is involved in exactly p − 3 = 8 minimal access sets.

Conclusion
In this paper, we studied the cyclic codes with generator polynomials derived from Fibonacci sequences modulo a prime p. We showed that such cyclic codes enjoy very good properties as they give examples of MDS and optimal cyclic codes. Also, we were able to determine all parameters of such codes. Finally, we present applications to secret sharing schemes via Fibonacci codes.