CN111831256A - Processing method of ultra-long digit division and computer readable storage medium - Google Patents

Processing method of ultra-long digit division and computer readable storage medium Download PDF

Info

Publication number
CN111831256A
CN111831256A CN202010617924.1A CN202010617924A CN111831256A CN 111831256 A CN111831256 A CN 111831256A CN 202010617924 A CN202010617924 A CN 202010617924A CN 111831256 A CN111831256 A CN 111831256A
Authority
CN
China
Prior art keywords
super
long
division
digit
ultra
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010617924.1A
Other languages
Chinese (zh)
Inventor
戚建淮
郑伟范
刘建辉
唐娟
宋晶
韩丹丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Y&D Electronics Information Co Ltd
Original Assignee
Shenzhen Y&D Electronics Information Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Y&D Electronics Information Co Ltd filed Critical Shenzhen Y&D Electronics Information Co Ltd
Priority to CN202010617924.1A priority Critical patent/CN111831256A/en
Publication of CN111831256A publication Critical patent/CN111831256A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/38Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation
    • G06F7/48Methods or arrangements for performing computations using exclusively denominational number representation, e.g. using binary, ternary, decimal representation using non-contact-making devices, e.g. tube, solid state device; using unspecified devices
    • G06F7/52Multiplying; Dividing
    • G06F7/535Dividing only

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Computational Mathematics (AREA)
  • Mathematical Analysis (AREA)
  • Mathematical Optimization (AREA)
  • Pure & Applied Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention relates to a processing method of ultra-long digit division, which comprises the following steps: s1, coding the super-long digit number based on the coding mode and the base number of the calculation system to generate a hierarchical super-long digit number code; and S2, carrying out division operation according to the sign of the super-long digit participating in the super-long digit division and the super-long digit code generated by the super-long digit. The invention also relates to a computer-readable storage medium. The processing method and the computer readable storage medium for implementing the ultra-long digit division provide an encoding method for the ultra-long digit exceeding the current computer processing digit by extracting an encoding symbol of the ultra-long digit N and then calculating the encoding level and the level base number corresponding to each level, and further provide a division calculation method based on the ultra-long digit encoding, can realize ultra-fast division operation of an ultra-large numerical value, and meet the requirements of large computational tasks such as large data analysis, processing, calculation and the like.

Description

Processing method of ultra-long digit division and computer readable storage medium
Technical Field
The present invention relates to the field of information encoding and calculation, and more particularly, to a processing method and a computer-readable storage medium for ultra-long bit number division.
Background
Large number operations, as the name implies, are a series of operations performed on a large number of values. It is known that there is no upper limit to the magnitude of a numerical value in mathematics, but in computers, the range that can be expressed by a computer is limited due to the word length limitation, and when we operate on a relatively small number, such a numerical value does not exceed the expression range of the computer, so that the operation can be performed. However, when we perform a large amount of data processing in practical applications, the range of values represented by the basic data types provided by the programming language is limited, and large-scale high-precision numerical calculation cannot be satisfied.
The majority of arithmetic is widely applied in the fields of information security, digital images, big data mining and the like at present. At present, common majority algorithms comprise a simulated manual calculation algorithm, a fast Fourier transform algorithm, a Chinese remainder theorem and the like, and the algorithms generally have the problem of low efficiency.
Disclosure of Invention
The technical problem to be solved by the present invention is to provide a processing method for super-long digit division and a computer readable storage medium, which can realize super-fast division operation of super-large numerical value, so as to meet the needs of large computational task such as large data analysis, processing, calculation, etc.
The technical scheme adopted by the invention for solving the technical problems is as follows: a processing method for ultra-long bit division is constructed, which comprises the following steps:
s1, coding the super-long digit number based on the coding mode and the base number of the calculation system to generate a hierarchical super-long digit number code;
and S2, carrying out division operation according to the sign of the super-long digit participating in the super-long digit division and the super-long digit code generated according to the super-long digit.
In the processing method of the very long bit number division, the step S1 further includes:
s11, adopting polynomial to change X into X for decimal super-long digit numbertXt-1……X1Expressed as X ═ X1*(10)0+X2*(10)1+……+Xt*(10)t-1T is a natural number, and the sign of X is X.bSign;
s12 traversing character string XtXt-1…X1Binary coding each character in the character string to obtain a coded character string and a first level base;
s13, traversing the code character string from the first non-zero character of the code character string, and carrying out binary coding on each character in the code character string to obtain a newly generated code character string and a next level base number; and carrying out binary coding on the newly generated coded character string obtained by each traversal until the finally generated character string is empty, and generating the hierarchical ultra-long bit number code based on the number of layers and the cardinal number of each level.
In the processing method of the very long bit number division, the step S12 further includes:
s121, traversing the character string X as X based on the following formulatXt-1…X1Binary encoding each character in the string to obtain an encoded string and a first level base:
based on Xt→Xt/2n=α1,Xt%2n=β1,X→α1Xt-1…X1
Xt-11*10→(Xt-11*10)/2n=α2,(Xt-11*10)%2n=β2,X→α1α2Xt-2…X1
……
X1γ-1*10→(X1γ-1*10)/2n=αγ,(X1γ-1*10)%2n=βγ,X→α1α2…αγ
Wherein the code string is alpha1α2…αγThe first level base is ═ βγB, carrying out the following steps of; n represents the maximum number of digits that the computer can calculate,% represents remainder, and/represents quotient, which are all integer operations.
In the processing method of the very long bit number division, the step S13 further includes:
s131, from the code character string alpha1α2…αγStarts with the first non-zero character of alpha1α2…αγAs X, the step S121 is performed to obtain a newly generated character string and a next level base;
s132, repeating the step S131 on the newly generated character string until the finally generated character string is empty;
s133, generating the hierarchical super-long bit number coding X ' ═ X ' based on the number of layers and the cardinality per hierarchy '1*(2n)0+X′2*(2n)1+……+X′u*(2n)u-1Wherein u represents the number of layers, X'1,X′2,……,X′uIs the base of each layer.
In the processing method of the very long bit number division, the step S2 further includes:
s21, generating the hierarchical super-long bit number codes M 'and N' based on the two super-long bit numbers M and N participating in the super-long bit number division:
M′=M′1*(2n)0+M′2*(2n)1+……+M′u*(2n)u-1u is the number of layers of the super-long digit M, M'1,M′2,……,M′uIs the base number of each layer; the symbol of M 'is M'.bSign,
N′=N′1*(2n)0+N′2*(2n)1+……+N′v*(2n)v-1V is the number of layers of the super-long digit N, and the sign of N 'is N'. bSign;
s22, arranging the super-long digit number codes M 'of the hierarchical levels as dividends and the super-long digit number codes N' of the hierarchical levels as divisors from right to left according to the hierarchy from low to high, and calculating the difference value of each hierarchy to obtain intermediate dividends;
s23, repeating the step S22 until the obtained intermediate dividend is smaller than the divisor N', and adding 1 to the initial statistical number of 0 every time of subtraction;
s24, binary coding the statistical times to obtain the quotient of the division result, and taking the intermediate dividend smaller than the divisor N' as the remainder of the division result;
s25, determining the sign of the division result based on M '. bSign and N'. bSign.
In the processing method of the very long bit number division, the step S22 further includes:
s221, calculating the intermediate dividend quotient based on the following formula:
Figure BDA0002562030640000041
obtaining the intermediate dividend quotient ═ q1,q2,……,qw]。
In the processing method of the very long bit number division according to the present invention, the step S23 further includes:
s231, judging whether the intermediate dividend quotient is larger than the divisor, if so, adding 1 to the statistical number frequency, assigning the intermediate dividend quotient to the dividend M' and repeatedly executing the step S221, otherwise, executing the step S24.
In the processing method of the very long bit number division according to the present invention, the step S24 further includes:
s241, binary coding the statistical number frequency to obtain a quotient resD [ R ] of the division result1,R2,……,Rt]Assigning the intermediate dividend quotient to a remainder rem of the division result, rem being quotient, and representing the remainder rem as rem being [ rem ═ rem1,rem2,……,remf]。
In the processing method of very long bit number division according to the present invention, in step S2, the SDN controller distributes the calculation task in parallel to each child node, and each child node calculates (M'1-N′1),(M′2-N′2),……,(M′v-N′v) And then returning the calculation result to the SDN controller, and summarizing the SND controller to obtain the intermediate dividend quotient.
Another technical solution to solve the technical problem of the present invention is to construct a computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the processing method of the very long bit number division.
The processing method and computer readable storage medium for implementing the ultra-long bit number division of the present invention is implemented by dividing an ultra-long bit number N (generally more than 2)64-1), extracting coding symbols, and then calculating coding levels and level cardinality corresponding to each level, thereby providing a coding method of ultra-long digits exceeding the processing digits of the current computer, and further providing a division calculation method based on ultra-long digit coding, which can realize ultra-fast division operation of ultra-large numerical values, thereby adapting to the needs of large computational tasks such as large data analysis, processing, calculation and the like.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a flow chart of a first preferred embodiment of the processing method of very long bit number division of the present invention;
FIG. 2 is a flow diagram of a preferred embodiment of the division calculation process of the processing method of very long bit number division of the present invention;
FIG. 3 is a flow chart of a specific embodiment of factoring according to the Shor algorithm using the ultra-long bit number coding processing method of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The invention aims to provide a method suitable for ultra-long digit coding and quick division calculation, which can finish the division calculation of complex tasks under the existing computer system and mainly comprises more than 264The ultra-long bit number coding mode and the division calculation process of-1 can realize that the bit number of the calculated data can far exceed the bit number which can be processed by the current computer and 2nCoding of very long digits in the (n is a natural number) system, while addressing 2nAnd (5) coding the binary system ultra-long digit. According to the invention, by defining different levels and carrying from a low level to a high level, parallel calculation can be carried out, so that a plurality of single-node parallel extensions with low calculation capacity and space time conversion can be adopted, ultra-fast ultra-large numerical calculation is realized, and the requirements of large calculation power for future big data calculation and information processing are met. The method can realize the exponential-grade quick division calculation of the ultra-long digit, and is suitable for the requirements of large-computing-power calculation tasks such as large-data analysis, processing, calculation and the like.
As shown in FIG. 1, the processing method of the ultra-long bit number division of the present invention is divided into two steps. In step S1, the super-long bit number is encoded based on the encoding mode and the calculation base number to generate a component level super-long bit number encoding. The encoded data structure includes: coding symbols, the number of coding levels and the corresponding hierarchical cardinality of each level. The code symbols mainly adopt true/false to represent "+" or "-" of the ultra-long digit. The coding level refers to the number of layers that can be coded by a super-long bit. The calculation system base number refers to the calculation system base number of each level, namely the ifAn ultra-long digit N is according to 2nAnd (n is a natural number) carrying out hierarchical coding on the system, wherein the base number of the hierarchical calculation system is as follows: 0 to 2n-1. In the calculation process of the calculation system base numbers, a Software Defined Network (SDN) mechanism can be adopted, and the SDN manager defines the calculation system base numbers in each hierarchy in a user intelligent definition mode, namely the base numbers are flexibly defined by the software defined network mechanism according to calculation tasks and the number of parallel distribution calculation nodes. The SDN manager is an intelligent management control device for realizing an SDN mechanism.
According to the coding mode definition and the calculation system base number definition, each super-long digit participating in calculation is coded through symbolic calculation to generate codes capable of adopting parallel calculation and provide super-long digit calculation support, and the specific calculation process is as follows:
the ultra-long digit number X in decimal is: x ═ XtXt-1……X1The polynomial can be expressed as follows:
X=X1*(10)0+X2*(10)1+……+Xt*(10)t-1t is a natural number, determined by the specific value of X, the sign of X: bSign, using true/false to represent "+" or "-" of an ultra-long digit "
Then, X is in accordance with 2nAnd (n is a natural number) carrying out coding. The encoding process is implemented by two cycles, a large cycle is embedded with a small cycle, the large cycle traverses all the encoded characters, and the small cycle traverses a single character pair 2 of the large cyclenAnd carrying out rounding operation and complementation operation.
The major cycle means that X is first followedtGo through to X1All characters in the character string are looped and binary coded to obtain a coded character string and a first level base.
The code string and the first level base number are obtained by a small loop, namely, a unit number (X) extracted from a large looptTo X1) To 2nPerforming rounding operation and remainder operation to obtain quotient and remainder part, and taking the product of remainder part and 10 and the sum of next digit character as the part for the next small-cycle start operationAnd dividing and accumulating the obtained quotient to be used as a new character string of the major loop. This process is repeated until the string becomes an empty string, and the loop ends. The number of the large-loop cycles is the number of the super-long digits, and the residue result obtained by the last operation of the small loop embedded in the large loop for one time is the base number of the corresponding number of the large loop.
Definition of α ═ α12,……,αk]For each small cycle, β ═ β12,……,βγ]U is the remainder of each small cycle, i.e. the number of layers after encoding the super-long digits of the hierarchy, γ is the number of small cycles in one large cycle, βγAnd representing the number obtained by the last small circulation, namely the base number of the corresponding layer, wherein u, e, k and gamma all belong to natural numbers. The specific process is as follows:
the first large loop traversal character string X ═ XtXt-1…X1Binary encoding each character in the string to obtain an encoded string and a first level base:
first minor cycle: xt→Xt/2n=α1,Xt%2n=β1,X→α1Xt-1…X1
And (3) a second small circulation:
Xt-11*10→(Xt-11*10)/2n=α2,(Xt-11*10)%2n=β2,X→α1α2Xt-2…X1
……
the γ th minor cycle:
X1γ-1*10→(X1γ-1*10)/2n=αγ,(X1γ-1*10)%2n=βγ,X→α1α2…αγ
completing the first major cycle to obtain a new code character string: alpha is alpha1α2…αGamma and first level radix X1′=βγ
The new encoding string is then: alpha is alpha1α2…αγAs a string of traversal of the next major loop. Second major loop from string alpha1α2…αγThe non-0 character starts to traverse to obtain a newly generated code string and a next level base, and the specific process is consistent with a small loop process to obtain the newly generated string and the next level base:
……
starting the u-th major cycle, and the minor cycle process is the same as the above until the finally generated character string is empty, thereby obtaining the highest layer u and the highest layer base Xu′=βγ. u is the number of layers of the coded X', and the number of coded super-long bits is as follows: x '═ X'1,X′2,……,X′u]Wherein the symbol of the code X 'is X'. bSign, the number of layers is CX=u;X′uThe code represented is 0 to 2n-1, resulting in a very long bit number code X'. Thus, the hierarchical super-long bit number code is generated based on the number of layers and the cardinality of each level, and the following expansion is carried out:
X′=X′1*(2n)0+X′2*(2n)1+……+X′u*(2n)u-1u belongs to a natural number, symbol of X': x'. bSign.
In step S2, a division operation is performed based on the sign of the super long digit participating in the super long digit division and the super long digit code generated based on the super long digit. FIG. 2 is a flow diagram of a preferred embodiment of the division calculation process of the processing method of very long bit number division of the present invention.
As shown in fig. 2, first, in step S21, the hierarchical super long digit codes M 'and N' are generated based on the two super long digits M and N participating in the super long digit division, that is, the two super long digits M and N are expressed as follows in decimal terms by a polynomial:
M=M1*(10)0+M2*(10)1+……+Mi*(10)i-1i belongs to a natural number, the sign of M: bSign;
N=N1*(10)0+N2*(10)1+……+Mj*(10)j-1j belongs to a natural number, the sign of N: bsign.
Then, M and N are as 2nThe (n is a natural number) system is encoded, and the encoding process is performed according to the example in step S1. Generating the hierarchical super long bit number codes M 'and N':
M′=M′1*(2n)0+M′2*(2n)1+……+M′u*(2n)u-1u is the number of layers of the super-long digit M, M'1,M′2,……,M′uIs the base number of each layer; the sign of M 'is M'. bSign,
N′=N′1*(2n)0+N′2*(2n)1+……+N′v*(2n)v-1v is the number of layers of the super-long digit number N, and the sign of N 'is N'. bSign.
In a specific calculation process, first, an intermediate dividend, a quotient, and a remainder involved in the division calculation may be defined, which are respectively represented by quotient, resD, and rem, where subscripts w, t, f, u, and v belong to natural numbers, u represents the number of layers of M ', and v represents the number of layers of N'.
quotient=[q1,q2,……,qw],qwThe intermediate dividend is corresponding to the w level;
resD=[R1,R2,……,Rt],Rtis the quotient corresponding to the t layer;
rem=[rem1,rem2,……,remf],remfis the remainder corresponding to the f layer.
Arranging the super-long bit number codes M 'and N' from right to left according to a low level, wherein the same coding level of the M 'and the N' is correspondingly arranged as follows:
Figure BDA0002562030640000091
the quotient is: rt……R2R1(ii) a The remainder is: rem ═ rem1,rem1,……,remf]
The overall idea of the realization of the ultra-long digit division is as follows: the subtraction is used to calculate how many divisors are in the dividend. In the calculation process, the SDN manager can dynamically distribute calculation tasks to each sub-node in parallel, and each sub-node respectively calculates (M'1-N′1),(M′2-N′2),……,(M′v-N′v) Then, the SDN controller performs summary calculation on the result to obtain a dividend M' subjected to primary subtraction, counts the number of subtraction times, adds one to the frequency, and finishes primary subtraction operation; after the same subtraction operation a plurality of times, the subtraction operation ends when the dividend is smaller than the divisor. The total number of statistics frequency is carried out 2 according to the coding process described abovenThe final result of the super-long digit division obtained after the coding is resD ═ R1,R2,……,Rt]The final dividend is the remainder rem ═ rem1,rem1,……,remf]。
Therefore, in step S22, the super-long bit number codes M 'of the hierarchical level as a dividend and the super-long bit number codes N' of the hierarchical level as a divisor are arranged from right to left in the order of levels from low to high, and the difference value of each level is calculated to obtain an intermediate dividend.
Initialization of the number of times frequency: frequency is 0;
the intermediate dividend quotient is calculated based on the following formula:
Figure BDA0002562030640000101
obtaining the intermediate dividend quotient ═ q1,q2,……,qw]。
In the step S23, the step S22 is repeatedly performed until the obtained intermediate dividend is smaller than the divisor N', and 1 is added to the initial statistical number of 0S every time the subtraction is performed. The method comprises the following specific steps:
judging the magnitude relation between the intermediate dividend quotient and the divisor N':
if the intermediate dividend quotient > N':
adding one to the statistical number, wherein frequency + 1; assigning the intermediate dividend quotient to the dividend M ', M' being quotient; and returning to the subtraction step, and continuing to perform the operation of quotient ═ M '-N'.
If quotient < N ', then step S24 is executed, i.e., the statistical number is binary-coded to obtain a quotient of the division result, and the intermediate dividend smaller than the divisor N' is used as a remainder of the division result.
The method comprises the following specific steps: assigning the intermediate dividend quotient to the remainder rem, wherein rem is quotient; the statistical frequency is carried out 2 according to the coding process described abovenThe final result of the super-long digit division obtained after the coding is resD ═ R1,R2,……,Rt]。
Binary-coding the statistical number frequency to obtain a quotient resD [ R ] of the division result1,R2,……,Rt]Assigning the intermediate dividend quotient to a remainder rem of the division result, rem being quotient, and representing the remainder rem as rem being [ rem ═ rem1,rem2,……,remf](t, f are natural numbers, 0. ltoreq. Rt<2n)。
Finally, step S25 is performed to determine the sign of the division result based on M '. bSign and N'. bSign. The remainder rem symbol may be expressed as: bsign, resd. The final division result can be expressed as a polynomial:
resD=(R1+rem1)*(2n)0+(R2+rem2)*(2n)1+……+Rt*(2n)t-1+remf*(2n)f-1t, f belong to natural numbers; the sign of resD: bsign, resd.
And finishing the division calculation of the ultra-long digit and finishing the description of the division calculation process.
The following embodiment is used to describe a specific encoding process of two extra-long digits, and the two extra-long digits after encoding are divided for calculation, and the division process is exemplified.
Example 1:
determining two super-long bit numbers A and B to be coded:
A=120623479892889324486908;B=27801936763830785484783867。
as mentioned above, the specific encoding process is as follows:
each bit character in the variable of the A and B character string type is paired with 216And performing rounding operation and remainder operation to obtain a quotient and a remainder, multiplying the remainder by 10 to obtain a cumulative part which is used as the initial operation part of the next character, obtaining the remainder as the base number of the corresponding layer number in the last small cycle, continuously repeating the process until the character string becomes an empty character string, and ending the cycle. And (4) once a large cycle (all characters in the character string cycle once), the remainder result is a base number corresponding to the super-long digit level.
Operating on string a-120623479892889324486908:
the first major loop, traverse the string: 120623479892889324486908:
first minor cycle: 1 → 1/216=0,reminder→1%216=1,
And 120623479892889324486908 → 020623479892889324486908;
and (3) a second small circulation: 2+1 10 → 12/216=0,reminder→12%216=12,
And 020623479892889324486908 → 000623479892889324486908;
and (3) a third small circulation: 0+12 10 → 120/216=0,reminder→12%216=120,
And 000623479892889324486908 → 000623479892889324486908;
...
the last small cycle, timer 252.
The second major cycle, the minor cycle is as above, and the timer is 1480.
The third large cycle, the small cycle is as above, and the timer is 65535.
The fourth major cycle, the minor cycle, is as above, and the timer is 782.
The fifth major loop, traversal starts with non-0 characters of the string:
first minor cycle: as above.
...
And (3) final small circulation: 6539 → 6539/216=0,reminder=6539%2166539, string → 0.
Obtaining an ultra-long bit number code: a' ═ 252,1480,65535,782,6539;
and (3) finishing all the cycles to obtain 5 levels of the ultra-long digit A, wherein the corresponding cardinality of each level is as follows: 252,1480,65535,782,6539.
After 5 times of the large loop character string 120623479892889324486908, the number of layers is 5, and m _ len is 5 in the corresponding super-long digit structure.
So far, the conversion of the ultra-long digit A is completed, and the converted code is as follows: a' ═ 252,1480,65535,782,6539], the notation is: a'. bSign ═ true.
The process is a reversible process, namely, the corresponding super-long digit can be obtained by the number of levels in the super-long digit structure and the cardinal number corresponding to the levels, and the process can be expressed by a polynomial as follows:
A′=252*(216)0+1480*(216)1+65535*(216)2+782*(216)3+6539(216)4
in summary, the cardinality analogy corresponding to the hierarchy is the number, tens, hundreds, thousands, etc. in the decimal system.
Similarly, the same operation is performed for the very long bit number B:
the first major loop, traverse string B27801936763830785484783867:
first minor cycle: 2 → 2/216=0,reminder→2%216=2,
And 27801936763830785484783867 → 07801936763830785484783867;
and (3) a second small circulation: 7+2 10 → 27/216=0,reminder→27%216=27,
And 07801936763830785484783867 → 00801936763830785484783867;
and (3) a third small circulation: 8+27 10 → 278/216=0,reminder→278%216=278,
And 00801936763830785484783867 → 00001936763830785484783867;
...
the last small cycle, timer 251.
The second large cycle, the small cycle is as above, and the timer is 148.
The third large cycle, the small cycle is as above, and the timer is 535.
The fourth major cycle, the minor cycle, is as above, and the timer is 782.
The fifth major cycle and the minor cycle are as above, and the timer is 65354.
The sixth major loop, traversal starts with the non-0 character of the string:
first minor cycle: as above.
...
And (3) final small circulation: 22 → 22/216=0,reminder=22%21622, string → 0.
B′=[251,148,535,782,65354,22];
And (3) finishing all the circulation to obtain 6 levels of the super-long digit B, wherein the corresponding cardinality of each level is as follows: 251,148,535,782,65354, 22.
After 6 times of the large loop character string 27801936763830785484783867, the number of layers is 6, and m _ len in the corresponding super-long digit structure is 6.
So far, the conversion of the super-long bit number B is completed, and the converted code is: b' ═ 251,148,535,782,65354, 22, the notation is: b'. bSign ═ true.
The process is a reversible process, namely, the corresponding super-long digit can be obtained by the number of levels in the super-long digit structure and the cardinal number corresponding to the levels, and the process can be expressed by a polynomial as follows:
B′=251*(216)0+148*(216)1+535*(216)2+782*(216)3+65354*(216)4+22*(216)5
in summary, the cardinality analogy corresponding to the hierarchy is the number, tens, hundreds, thousands, etc. in the decimal system.
So far, the encoding process of two super-long digits of the embodiment is finished.
Since their signs are all "+", a.bsign ═ true, b.bsign ═ true, and readd.bsign ═ true. Hierarchical super-long bit number coding is obtained as before:
A′=[252,1480,65535,782,6539];
B′=[251,148,535,782,65354,22];
a 'and B' can be represented by polynomials as follows:
A′=252×(216)0+1480×(216)1+65535×(216)2+782×(216)3+6539×(216)4
B′=251×(216)0+148×(216)1+535×(216)2+782×(216)3+65354×(216)4+22×(216)5
the division operation of A 'and B' is specifically as follows:
divisor: and A is 120623479892889324486908.
Dividend: and B is 27801936763830785484783867.
And their signs are all "+", so a.bsign ═ true, b.bsign ═ true, and resd.bsign ═ true.
The division operation of A 'and B' is specifically as follows:
A.bSign=true,B.bSign=true;
A.m_len=5,A.m_data[]=[252,1480,65535,782,6539];
B.m_len=6,B.m_data[]=[251,148,535,782,65354,22];
the division operation is A/B, the general idea is to calculate the number of dividends in dividends by using subtraction operation, and the specific steps are as follows:
an example operation of looping B-A until A < B, one subtraction is as follows:
Figure BDA0002562030640000151
after counting the number of times of subtraction, 216The binary system is coded to be a quotient, and the rest number is a remainder.
The result obtained after calculation is as follows:
the quotient is [230] and the remainder is [7827,52963,759,17300,3173 ].
Thus:
resD.bSign=true。
resD.m_len=5。
resD=[230]……[7827,52963,759,17300,3173]。
so far, the example of the division process of the ultra-long digit is completed, and the embodiment 1 is completed.
The processing method of the ultra-long digit division can be applied to the calculation scenes of factorization of ultra-long digits, ultra-high dimensional matrix calculation, image processing and the like. For example, solving the super long bit number coding and super long bit number calculation process required in the super long bit number factorization process solved by using the shor algorithm. The factorization process for solving the ultra-long digit by using the shor algorithm is to use more than 264After the super-long bit large composite number N of the-1 is coded by the super-long bit number, the total number of layers calculated by the SDN controller according to the processing method of the super-long bit number division method is distributed to different corresponding number of distributed computing nodes according to task requirements, and the data in each node can exceed 264-1, performing a representation calculation according to a coded hierarchical scale of very long bits. In the process of decomposing the ultra-long bit large combination number N by using the shor algorithm, the SDN controller comprehensively collects and controls the result to obtain a final ultra-long bit calculation result. Therefore, when the shor algorithm is used for solving the prime factor of the overlength bit large composite number N, the required data operation exceeds that of the existing computerMaximum data representation (2)64-1), coding of very long digits and division of very long digits are used in the calculation. Therefore, the problem that the existing computer cannot be used for calculation due to too large data can be well solved by using the super-long digit code and the super-long digit division operation for calculation.
FIG. 3 is a flow chart of a specific embodiment of factoring according to the Shor algorithm using the ultra-long bit number coding processing method of the present invention. As shown in fig. 3, one will exceed 2512The large resultant A is calculated by a Shor algorithm according to the coding operation process of the ultra-long digit, wherein the calculation process comprises the division calculation process of the ultra-long digit.
As shown in step S31 in fig. 3, the ultra-long bit composite is determined:
A=89884656743115795386465259539451236680898848947115328636715040578866337902750481566354238661203768010560056939935696678829394884407208311246423715323561981300002286071312272406526781657562786883878946793069280737057523435732477591317599646617126077367662938702372050520303688765359321867171510601857712632753。
the total number is calculated by adopting a traditional calculation method, the difficulty of exceeding the computer representation bit exists in the existing computer, and the difficulty can be well solved based on the method of the invention.
And then according to the step S32, carrying out super-long digit coding on the super-long digit composite number A to obtain hierarchical super-long digit coding.
And finally, according to the substep S33, the coded overlength digit A is coded according to the overlength digit by using a Shor algorithm, wherein the processing method comprises the processing method of the overlength digit division of the invention, and the prime factors q1 and q2 are solved. The result obtained after calculation is:
q1=6703903964971298549787012499102923063739682910296196688861780721860882015036773488400937149083451713845015929093243025426876941405973284973216824503307637。
q2=13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006123469。
the invention provides a coding method of super-long digit which exceeds the current computer processing digit, and is convenient for computing the super-long digit under the existing computing system. The present invention is based on the existing computer architecture and combines an ultra-long digit number N (generally more than 2)64-1), performing symbol extraction and then coding by symbol computation into a hierarchical coding that can directly participate in the operation, the coded data structure comprising: coding symbols, the number of coding levels and a grading base number corresponding to each level, and the three steps realize the coding of the ultra-long digit. The invention further provides a division calculation method based on the ultra-long digit number coding, and the exponential-level quick calculation speed is realized. The invention also discloses a division calculation method and a calculation process of the ultra-long digit code based on the defined ultra-long digit code, and realizes the exponential-level quick calculation of the long ultra-digit code. The method provided can meet the requirement of rapid information processing of big data calculation.
Another technical solution adopted by the present invention to solve the technical problem is to construct a computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method for preventing timestamp attacks in a blockchain system.
Accordingly, the present invention can be realized in hardware, software, or a combination of hardware and software. The present invention can be realized in a centralized fashion in at least one computer system, or in a distributed fashion where different elements are spread across several interconnected computer systems. Any kind of computer system or other apparatus adapted for carrying out the methods of the present invention is suited. A typical combination of hardware and software could be a general purpose computer system with a computer program that, when being loaded and executed, controls the computer system such that it carries out the methods described herein.
The present invention may also be implemented by a computer program product, comprising all the features enabling the implementation of the methods of the invention, when loaded in a computer system. The computer program in this document refers to: any expression, in any programming language, code or notation, of a set of instructions intended to cause a system having an information processing capability to perform a particular function either directly or after either or both of the following: a) conversion to other languages, codes or symbols; b) reproduced in a different format.
While the invention has been described with reference to specific embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted without departing from the scope of the invention. In addition, many modifications may be made to adapt a particular situation or material to the teachings of the invention without departing from its scope. Therefore, it is intended that the invention not be limited to the particular embodiment disclosed, but that the invention will include all embodiments falling within the scope of the appended claims.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A processing method of ultra-long bit number division is characterized by comprising the following steps:
s1, coding the super-long digit number based on the coding mode and the base number of the calculation system to generate a hierarchical super-long digit number code;
and S2, carrying out division operation according to the sign of the super-long digit participating in the super-long digit division and the super-long digit code generated according to the super-long digit.
2. The processing method of very long bit number division as claimed in claim 1, wherein said step S1 further comprises:
s11, adopting polynomial to change X into X for decimal super-long digit numbertXt-1……X1Expressed as X ═ X1*(10)0+X2*(10)1+……+Xt*(10)t-1T is a natural number, and the sign of X is X.bSign;
s12 traversing character string XtXt-1…X1Binary coding each character in the character string to obtain a coded character string and a first level base;
s13, traversing the code character string from the first non-zero character of the code character string, and carrying out binary coding on each character in the code character string to obtain a newly generated code character string and a next level base number; and carrying out binary coding on the newly generated coded character string obtained by each traversal until the finally generated character string is empty, and generating the hierarchical ultra-long bit number code based on the number of layers and the cardinal number of each level.
3. The processing method of very long bit number division as claimed in claim 2, wherein said step S12 further comprises:
s121, traversing the character string X as X based on the following formulatXt-1…X1Binary encoding each character in the string to obtain an encoded string and a first level base:
based on Xt→Xt/2n=α1,Xt%2n=β1,X→α1Xt-1…X1
Xt-11*10→(Xt-11*10)/2n=α2,(Xt-11*10)%2n=β2,X→α1α2Xt-2…X1
……
X1γ-1*10→(X1γ-1*10)/2n=αγ,(X1γ-1*10)%2n=βγ,X→α1α2…αγ
Wherein the code string is alpha1α2…αγThe first level cardinality is: beta is aγB, carrying out the following steps of; n represents the maximum number of digits that the computer can calculate,% represents remainder, and/represents quotientIs an integer operation.
4. The processing method of very long bit number division as claimed in claim 3, wherein said step S13 further comprises:
s131, from the code character string alpha1α2…αγStarts with the first non-zero character of alpha1α2…αγAs X, the step S121 is performed to obtain a newly generated character string and a next level base;
s132, repeating the step S131 on the newly generated character string until the finally generated character string is empty;
s133, generating the hierarchical super-long bit number coding X ' ═ X ' based on the number of layers and the cardinality per hierarchy '1*(2n)0+X'2*(2n)1+……+X'u*(2n)u-1Wherein u represents the number of layers, X'1,X'2,……,X'uIs the base of each layer.
5. The processing method of very long bit number division as claimed in claim 4, wherein said step S2 further comprises:
s21, generating the hierarchical super-long bit number codes M 'and N' based on the two super-long bit numbers M and N participating in the super-long bit number division:
M'=M'1*(2n)0+M'2*(2n)1+……+M'u*(2n)u-1u is the number of layers of the super-long digit M, M'1,M'2,……,M'uIs the base number of each layer; the sign of M 'is M'. bSign,
N'=N'1*(2n)0+N'2*(2n)1+……+N'v*(2n)v-1v is the number of layers of the super-long digit N, and the sign of N 'is N'. bSign;
s22, arranging the super-long digit number codes M 'of the hierarchical levels as dividends and the super-long digit number codes N' of the hierarchical levels as divisors from right to left according to the hierarchy from low to high, and calculating the difference value of each hierarchy to obtain intermediate dividends;
s23, repeating the step S22 until the obtained intermediate dividend is smaller than the divisor N', and adding 1 to the initial statistical number of 0 every time of subtraction;
s24, binary coding the statistical times to obtain the quotient of the division result, and taking the intermediate dividend smaller than the divisor N' as the remainder of the division result;
s25, determining the sign of the division result based on M '. bSign and N'. bSign.
6. The processing method of very long bit number division as claimed in claim 5, wherein said step S22 further comprises:
s221, calculating the intermediate dividend quotient based on the following formula:
Figure FDA0002562030630000031
obtaining the intermediate dividend quotient ═ q1,q2,……,qw]。
7. The processing method of very long bit number division as claimed in claim 6, further comprising at said step S23:
s231, judging whether the intermediate dividend quotient is larger than the divisor, if so, adding 1 to the statistical number frequency, assigning the intermediate dividend quotient to the dividend M' and repeatedly executing the step S221, otherwise, executing the step S24.
8. The processing method of very long bit number division as claimed in claim 7, further comprising at said step S24:
s241, binary coding the statistical number frequency to obtain a quotient resD [ R ] of the division result1,R2,……,Rt]Removing the middleThe number quotient is assigned to the remainder rem of the division result, rem equals to quotient, and the remainder rem is expressed as rem equals to [ rem1,rem2,……,remf]。
9. The processing method of very long bit number division according to claim 7, wherein in said step S2, SDN controller distributes calculation task to each child node in parallel, each child node calculates (M'1-N'1),(M'2-N'2),……,(M'v-Nv') and then returning the calculation results to the SDN controller, the SND controller summarizing the intermediate dividend quotients.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out a method of processing a very long bit number division as claimed in any one of claims 1 to 9.
CN202010617924.1A 2020-06-30 2020-06-30 Processing method of ultra-long digit division and computer readable storage medium Pending CN111831256A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010617924.1A CN111831256A (en) 2020-06-30 2020-06-30 Processing method of ultra-long digit division and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010617924.1A CN111831256A (en) 2020-06-30 2020-06-30 Processing method of ultra-long digit division and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN111831256A true CN111831256A (en) 2020-10-27

Family

ID=72899938

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010617924.1A Pending CN111831256A (en) 2020-06-30 2020-06-30 Processing method of ultra-long digit division and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111831256A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130311532A1 (en) * 2012-05-19 2013-11-21 Eric B. Olsen Residue number arithmetic logic unit
CN108804933A (en) * 2018-05-25 2018-11-13 东北大学 A kind of system conversion method for big data
CN110119265A (en) * 2018-02-06 2019-08-13 成都鼎桥通信技术有限公司 Multiplication implementation method, device, computer storage medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130311532A1 (en) * 2012-05-19 2013-11-21 Eric B. Olsen Residue number arithmetic logic unit
CN110119265A (en) * 2018-02-06 2019-08-13 成都鼎桥通信技术有限公司 Multiplication implementation method, device, computer storage medium and electronic equipment
CN108804933A (en) * 2018-05-25 2018-11-13 东北大学 A kind of system conversion method for big data

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
DAMONMAI: ""一个超长字符串表示的十进制数转化为十六进制的字符串"", 《HTTPS://BLOG.51CTO.COM/U_9492221/1564392》 *
好想告诉你WT: ""C++使用string的大数除法运算(4)"", 《HTTPS://WWW.JB51.NET/ARTICLE/170280.HTM》 *
龚成清 等: ""基于 delphi 的超长整数四则运算的实现"", 《宁波职业技术学院学报》 *

Similar Documents

Publication Publication Date Title
Cortese et al. Loading classical data into a quantum computer
Wolfram Random sequence generation by cellular automata
Hasan et al. A modified Massey-Omura parallel multiplier for a class of finite fields
US7921145B2 (en) Extending a repetition period of a random sequence
CN112162723B (en) Quantum subtraction operation method, device, electronic device and storage medium
von zur Gathen Irreducibility of multivariate polynomials
KR100756137B1 (en) Division and square root arithmetic unit
Sharma Complexity of real root isolation using continued fractions
Karpinski et al. A method for decimal number recovery from its residues based on the addition of the product modules
CN111831256A (en) Processing method of ultra-long digit division and computer readable storage medium
CN112364985A (en) Convolution optimization method based on distributed coding
Bournez et al. Reachability problems for one-dimensional piecewise affine maps
CN111831253A (en) Processing method for super-long digit subtraction and computer readable storage medium
CN111831252A (en) Processing method for super-long digit addition and computer readable storage medium
CN111831255A (en) Processing method and computer readable storage medium for ultra-long digit multiplication
US7257224B2 (en) Cryptographical pseudo-random number generation apparatus and program
CN110990776B (en) Coding distributed computing method, device, computer equipment and storage medium
Martínez et al. Powers of large matrices on GPU platforms to compute the roman domination number of cylindrical graphs
WO2024109730A1 (en) Variable modular multiplier, operation method, and related device
Azim et al. Graphs and codes produced by a new method for dividing a natural number by two
JPH0749769A (en) Power arithmetic unit
CN110046875B (en) Hardware implementation method and device of siacoin ore excavation algorithm
Zhao et al. Research on optimization method for ordinal calculation of non-deterministic combinatorial coding
CN117035103A (en) Processing method and device of data decomposition task, storage medium and electronic device
Schoenbaum A Tapered Floating Point Extension for the Redundant Signed Radix 2 System Using the Canonical Recoding

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201027

RJ01 Rejection of invention patent application after publication