Graphs and codes produced by a new method for dividing a natural number by two
M. Zeynali Azim, M.A. Jabraeil Jamali, B. Anari, S. Alikhani, S. Akbarpour
aa r X i v : . [ c s . D M ] M a r Graphs and codes produced by a new method for dividinga natural number by two
M. Zeynali Azim a , M.A. Jabraeil Jamali a, ∗ , B. Anari a , S. Alikhani b , S. Akbarpour aa Department of Computer Engineering, Shabestar Branch, Islamic Azad University,Shabestar, Iran m [email protected] b Department of Mathematics, Yazd University, 89195-741, Yazd, Iran
Abstract
In this paper, we introduce a new method which we call it MZ-method, fordividing a natural number x by two and then we use graph as a model to showMZ-algorithm. Applying (recursively) k -times of the MZ-method for the number x ,produces a graph with unique structure that is denoted by G k ( x ). We investigatethe structure of G k ( x ). Also from the natural number x and graph G k ( x ) weproduce codes which are important and applicable in the information security andcryptography. Keywords: graph, division, code.
A division algorithm is an algorithm which, given two integers N and D , computestheir quotient and/or remainder, the result of Euclidean division. Some are appliedby hand, while others are employed by digital circuit designs and software. For a realnumber x and an integer n ≥
0, let [ x ] n denote the (finite) decimal expansion of thegreatest number that is not greater than x , which has exactly n digits after the decimalmark. Let d i denote the last digit of [ x ] i . It is straightforward to see that [ x ] n may beobtained by appending d n to the right of [ x ] n − . This way one has[ x ] n = [ x ] .d d ...d n − d n , It is obvious that for an integer x , [ x ] n = [ x ] .d , where d = 0, or d = 5. Inmathematics, division by two or halving has also been called mediation or dimidiation[3]. The treatment of this as a different operation from multiplication and divisionby other numbers goes back to the ancient Egyptians, whose multiplication algorithm ∗ Corresponding author x by two. With our knowledge this method is not in any literature.Then we use graph as a model to show MZ-algorithm. Applying k -times of the MZ-method for the number x , creates a graph with unique structure that is denoted by G k ( x ). We investigate the structure of G k ( x ) in the next section. Also from the naturalnumber x and graph G k ( x ), in Section 3, we produce codes which are important andapplicable in the information security and cryptography. In this section, we first present a new algorithm which we call it MZ-algorithm fordivision by two.STEP 1: Consider an input natural number x and write x as a n − a n − ...a a .STEP 2: Write a j as b j t j (0 ≤ j ≤ n − b j = ⌊ a j ⌋ and t j = (cid:0) a j −⌊ a j ⌋ (cid:1) × x = c n c n − ...c .c , where c n = ⌊ a n − ⌋ , c = t and c j = b j − + t j for1 ≤ j ≤ n −
1. 2igure 1: Algorithm for the devision number 375 by two.To prove this algorithm, we state and prove the following theorem:
Theorem 2.1
Let x = a n − a n − ...a a be a natural number. Then x c n c n − ...c .c , where c n = ⌊ a n − ⌋ , c = (cid:0) a − ⌊ a ⌋ (cid:1) × and c j = ⌊ a j − ⌋ + (cid:0) a j − ⌊ a j ⌋ (cid:1) × . Proof.
We know that the number x is equal to a + a × a × + ... + a n − × n − and so x a a × a ×
50 + ... + a n − × × n − . (1)We shall show that x = c n c n − ...c .c . We write this number as c n × n − + c n − × n − + ... + c + c . By substituting c j , we have: ⌊ a n − ⌋ × n − + (cid:16) ⌊ a n − ⌋ + (cid:0) a n − − ⌊ a n − ⌋ (cid:1) × (cid:17) × n − + ... + ⌊ a ⌋ + a − ⌊ a ⌋ × . (2)Obviously the Equation (2) is equal to Equation (1) and so we have the result. (cid:3) As an example, Figure 1 illustrates the MZ-algorithm for division number 375 bytwo. 3igure 2: The graph G (458).Figure 3: The graph G (375). In this section, we use MZ-algorithm recursively and produce graphs and codes.A graph is a pair G = ( V, E ), where V is the vertex set and E is an edge set. Let touse graph as a model for MZ-algorithm. Every digit in a number denoted by a vertexand edges of graph draw based on MZ-algorithm. We have shown the division of thenumber 458 by two in Figure 2. This graph (Figure 2) which we call it division graphby two (DGBT) is a path of order 13, i.e., P .Applying (recursively) k -times of the MZ-method for the number x , produces agraph which we denote it by G k ( x ). The following theorem is easy to obtain: Theorem 3.1
Let x be a natural number with n digit. The division graph D ( x ) is apath graph P n +1 . It is easy to see that G k ( n ) is not tree for k >
1, since the graph has cycle. See thegraphs G (375) and G (35) in Figures 3 and 4. Since DGBT is an infinite graph, letto show some of DGBT in bitmap model. In bitmap model each numbers in 0 , , , ..., G (35).Figure 5: Bitmap model for the graph G (7) Theorem 3.2
Let x be a d -digit natural number.(i) The order of graph G k ( x ) is (3 k + 1) d + k (3 k − .(ii) The number of cycle C in the graph G k ( x ) is k − (2 d + k − .(iii) For every natural numbers k, n , the graph G k ( n ) has exactly two end vertex (leaf ). Proof. (i) By construction of graph G k ( x ), the number of vertices is equal to d + 2 d + ( d + 1) + 2( d + 1) + ( d + 2) + 2( d + 2) + ... + 2( d + k −
1) + d + k, which is equal to (3 k + 1) d + k (3 k − G k ( x ) observe that the number of cycle C is d + ( d +1) + ( d + 2) + ... + ( d + k − , which is equal to k − (2 d + k − (cid:3) Figure 6: Bitmap model for some DGBT.Random numbers are useful for a different of purposes, such as generating dataencryption keys, simulating and modeling complex phenomena and for selecting randomsamples from larger data sets. They have also been used aesthetically, for example inliterature and music, and are of course ever popular for games and gambling. Ourassumption has been that random numbers cannot be computed; because computersoperate in deterministic way, they cannot produce random numbers. Instead, randomnumbers are best obtained using physical (true) random number generators [4]. MZ-algorithm produce numbers that we think can be consider as true random generator.Also we can construct binary codes from MZ-algorithm and its associated graph. Wereplace labeled numbers to vertices of graph G k ( x ) by 1 (for odd numbers) and by 0(for even numbers). Let to call this graph BG k ( x ). See Figure 7.As we saw in previous section, DGBT is an infinite graph so it related binary graph(BG) is also infinite graph. We have drawn some BG in bitmap format, see Figure 8.After simulating and drawing the bitmap model of BG, observe that the MZ-algorithm6igure 7: The G (265) and its binary graph BG (265).BG is similar to a cellular automaton and can be defined as its role. Also, due to thelack of specific pattern, we think that BG can be used for cryptography and generatingrandom numbers. We know that an ( n, M, d )-code C over F is a M -subset of codewordsof length n which d is the minimum distance in C . A good ( n, M, d ) code has small n and large M and d (see [1]). It is obvious that every natural number x with n digits isa codeword of length n such that its weight is equal to the number of odd digits in x .Now by MZ-algorithm the number x is a binary codeword and using G k ( x ) can producecodeword of lengths 2( n + k −
1) and n + k , where k ∈ N . So from a ( n, M, d )-code C we construct ( n + k, M, d )-code C and (2( n + k − , M, d )-code C . Example 3.3
Consider number x with three digit , , . We know that there are sixdistinct numbers with these three digits. In other words we have the following code: C = { , , , , , } . We can write this code as binary code as C = { , , , , } . Let C k ( { , , } ) denote the code of length k which has produced by MZ-algorithm and their correspondinggraphs. It is not hard to see that C ( { , , } ) = { , , , , , } . C ( { , , } ) = { , , , , , } C ( { , , } ) = { , , , , , } ote that C , C and C is (8 , , -code, (9 , , -code and (10 , , -code, respec-tively. It is interesting that the MZ-method and corresponding graph G k ( x ) gives uniquecodewords for every k ≥
3. See Figure 8. However, until now attempts to prove thisproperty failed. Let to state the following conjecture:
Conjecture 3.4
The MZ-algorithm and BG k ( x ) produce distinct binary codewords forevery k ≥ . Here we use MZ-algorithm and BG k to construct ( n, M, d )-codes which their mini-mum distance is almost n ± i , where i is an integer.STEP 1: Input t ! natural numbers such as x with t distinct digit.STEP 2: Apply MZ-algorithm for each x , and its result, recursively.STEP 3: In the k -th step and by replacing even digit by 0 and odd digit by 1 wehave a binary codeword C k ( x ) of length t + k .STEP 4: Delete the digit(s) 0 before the first digit 1 from the left of codeword C k ( x ) and denote this codeword as C ′ k ( x )STEP 5: For enough large k , the set C ′ = { C ′ k ( x ) } is a ( t + k − k , t ! , d )-code, where d is almost t + k − k and k is the number of deleted 0 in STEP 4. Example 3.5
Consider three numbers , , . We Use MZ-algorithm and DBGT foreach six numbers which constructed by these numbers. For k = 10 we have the follow-ing codewords: C (625) = 0000101111001 , C (526) = 0001110110110 , C (562) =0001000001010 , C (652) = 0000101101100 , C (265) = 0000101010001 , C (256) =0000100000000 For more information about this code please see binary graph represen-tation of BG (265) for k = 10 in Figure 9. By deleting three zeros from the left of these codewords, we have: C ′ = { , , , , , } . For example, we show that deleting 3 zero from left side of BG (265), see Figure 10.9igure 9: Binary graph representation of number 265 for k = 10.Figure 10: Deleting zero from left side of BG (265)Note that C ′ is a (10 , , { } List [] =Generate t ! decimal number from N[]Get k for generate CodeWhile element in list[]Construct binary tree until to L = 2 ∗ k for any element in list[]List2[]=Get Code from Level (L) in binary treeEnd of whileMinimum zero= Compare all of element in list2[] and find minimum zero from left side k =minimum zeroWhile element in list2[]While i¡ len(list2[])d=find distance (element, list2[i+1])d list[]=add(d)End of whileEnd of whileminimum d=find min(d list)average of code length=compute(( t + k − k ) / t + k − k , t !, minimum d)-code Example 3.6
Using this procedure we have the following results:(i) C ′ ( { , , } ) = { , , , , , } which is a (24 , , -code.(ii) C ′ ( { , , } ) is a (38 , , -code.(iii) C ′ ( { , , } ) is a (314 , , -code. We observed that by using MZ-algorithm and BG we can produce codes of length m which their minimum distance is almost m/ k , we think that there is a characterization fornumber and parameters of codes for which d is exactly n or n ± i , where n is the lengthof code and i is an integer number. Since d is almost near to n , we were curious to drawthe level to level distance based (from k = 1 to k = 300) bitmap model for 256, 625and scatter chart for all codes from three numbers 2 , ,
6. After drawing the shape, wewere astonished to see that the pattern was appear to be random. So we think that itcan be used in random number generation and cryptography applications. see Figures11 and 12. 11igure 11: Distance based bitmap of two numbers 256, 625, for k = 1 tok = 300.Figure 12: Scatter chart for code of numbers 2 , , k = 1 , ..., d representation in Figure 13. As wecan see, the number of 1’s (or minimum distance) is equal or almost equal to half oflength, i.e., n . However, until now all attempts to find a characterization failed.Figure 13: Pie chart for all generated codes by numbers 2 , , d .We close the paper with the following problem: Problem 3.7
Characterize natural number x and k for which a produced code ( n, M, d ) from MZ-algorithm and DBGT, D k ( x ) has d = n ± i , where i is an integer number. eferences [1] R. Hill, (1986), A first course in coding theory, Oxford University Press.[2] L.L. Jackson, (1906), The educational significance of sixteenth century arithmeticfrom the point of view of the present time, Contributions to education, 8, ColumbiaUniversity, p. 76.[3] R. Steele, (1922), The Earliest arithmetics in English, Early English Text Society,118, Oxford University Press, p. 82.[4] M. Stipˇceviˇc and C.K. Koc, True Random Number Generators, Available at: [5] E.G.R. Waters, (1929), A Fifteenth Century French Algorism from Lige, Isis, 12(2): 194236.[6] See https://en.wikipedia.org/wiki/Division by twohttps://en.wikipedia.org/wiki/Division by two