APPLICATION OF THE BASIC MODULE'S FOUNDATION FOR FACTORIZATION OF BIG NUMBERS BY THE FЕRMАT METHOD

At present, the issue of information security is one of the most relevant. One of the ways to solve it is information encryption. Among the ways of encryption, the asymmetric crypto-algorithm (ACA) RSA has acquired widespread application. Its cryptographic resistance is caused by the complexity of factorization of big numbers N= , p q ⋅ where p and q are prime numbers. In papers [1, 2], it was shown that the known examples of compromising the RSA algorithm work only for its specific implementations, and, as a rule, in the general case are not most effective for solving a factorization problem. Up to now, many factorization methods have been developed. The most frequently used methods include the methods of the number field sieve (GNFS), the quadratic sieve method (QS), the Pollard method and the Fermat method [3–6]. In this case, it is believed that each of these methods is the best (most effective in terms of computational complexity) for its application area. Thus, the Fermat method is most effective at sufficiently close values of prime factors p and q, The Pollard 16. Twisted Edwards Curves / Bernstein D. J., Birkner P., Joye M., Lange T., Peters C. // Lecture Notes in Computer Science. 2008. P. 389–405. doi: https://doi.org/10.1007/978-3-540-68164-9_26 17. Bessalov A. V., Kovalchuk L. V. Exact Number of Elliptic Curves in the Canonical Form, Which are Isomorphic to Edwards Curves Over Prime Field // Cybernetics and Systems Analysis. 2015. Vol. 51, Issue 2. P. 165–172. doi: https://doi.org/10.1007/s10559015-9709-x 18. Bessalov A. V., Dihtenko A. A. Cryptographically resistant Edwards curves over prime fields // Applied Radio Electronics. 2013. Vol. 12, Issue 2. P. 285–291. 19. Bespalov O. Yu., Kuchynska N. V. Kryva Edvardsa nad kiltsem lyshkiv yak dekartiv dobutok kryvykh Edvardsa nad skinchenymy poliamy // Prikladnaya radioelektronika. 2017. Vol. 16, Issue 3-4. P. 170–175.


Introduction
At present, the issue of information security is one of the most relevant.One of the ways to solve it is information encryption.Among the ways of encryption, the asymmetric crypto-algorithm (ACA) RSA has acquired widespread application.Its cryptographic resistance is caused by the complexity of factorization of big numbers N= , p q ⋅ where p and q are prime numbers.In papers [1,2], it was shown that the known examples of compromising the RSA algorithm work only for its specific implementations, and, as a rule, in the general case are not most effective for solving a factorization problem.
Up to now, many factorization methods have been developed.The most frequently used methods include the methods of the number field sieve (GNFS), the quadratic sieve method (QS), the Pollard method and the Fermat method [3][4][5][6].In this case, it is believed that each of these methods is the best (most effective in terms of computational complexity) for its application area.Thus, the Fermat method is most effective at sufficiently close values of prime factors p and q, The Pollard

Literature review and problem statement
It is commonly known that the Fermat method is used only for factors p and q of number N that are close by values.The region of its application is quite narrow.The main ideas, associated with reduced computational complexity of the algorithm that implements it, were proposed and studied relatively long ago and are presented in paper [9].
According to the classic variant of the algorithm of the Fermat method [10,11], to derive the values of p and q, the equation is solved where X and Y are positive integers.Unknown Х is represented in the form of ( ) The solution to equation ( 1) is obtained by searching the values of k=0, 1, 2,…, until residue 2 X N -is complete square of integer.If solution ( 1) is obtained at p and q are determined according to ratios: The main disadvantage of the Fermat factorization method is the need for multiple performance of arithmetically complex operations of raising to square, subtraction and calculating the square root for big numbers, which determines its computational complexity.In this case, it is necessary to distinguish between the following components of the problem of high computational complexity of the basic algorithm: 1) a large number of X, for which the ratio (1) should be checked; 2) significant computational complexity of the operation of deriving square root of multidigit numbers; 3) high computational complexity of the operations of multiplication and addition of multidigit numbers.
In most of the known variants of reduction of computational complexity of the Fermat factorization method, the procedure of preliminary sifting either of analyzed values X, or reduction of the check operations of square root calculation is used.One of the ways of solving the first problem is based on the results of analysis of values m of lower bits of a factorized number [12].Paper [9] considers the possibility of increasing the pitch of thinning, but the value of such a pitch is a permanent magnitude.Such permanent pitch can be equal to values of 2, 4, 6 and, in rare cases, of 12.However, it cannot significantly affect the reduction of computational complexity of the algorithm of the Fermat method.That is why the search for the ways of reduction of the number of check X, for which ration (1) is checked, is one of the tasks that are explored in this study.
The options of the solution of the second problem were proposed in [13,14], where a reduction in the number of operations of square root calculation is achieved by the results of analysis of least significant bits y 2 .A modified version of these algorithms is presented in [15].In paper [16], the method for determining that the square root is not an integer without the procedure of root calculation was proposed.
In papers [17,18], reduction of computational complexity of the Fermat factorization method is ensured through the use of modular arithmetic and the apparatus of continuous fractions, respectively.
In [9], it is proposed to check whether the difference X 2 -N by module of a certain set of foundations of modules b that are prime numbers will be quadratic residue.
At satisfaction of ratio (1) for an arbitrary foundation of module, the equality will be satisfied ( ) which is equivalent to satisfaction of the ratio It should be noted that if the ratio (1) is satisfied, there is equality (4) and ( 5) for an arbitrary b.The opposite is false, that is, satisfaction of (1) does not follow from satisfaction of (5).However, if the ratio (5) is not satisfied, the ratio (1) will not be satisfied.That is why for the X, for which (5) is not satisfied, it may not be possible to derive square root, as it may not be the exact square of an integer.
Through the implementation of checks (5) for set of foundations of modules, computational complexity of the Fermat method decreases.If each of the modules is a prime number, then, as noted in [9], when using one additional module in (5), the number of X, for which difference X 2 -N can be complete square, decreases actually by two times.Such X will be subsequently called admissible.
However, when using the first foundation of modules, which will be subsequently called basic and designated bb, the number of X, for which the ratios (5) will be analyzed at other values of modules, will decrease only approximately by half.
Let us assume that bb is a foundation of module and bb * is the number of roots of the equation (5) at b=bb.If subsequently during analysis of the check X, only bb * of them will be analyzed, the number of analyzed X will decrease by the number of times equal to ( , ) / *, Z N bb bb bb = ( 6 ) where Z(N, bb) will subsequently be called acceleration coefficient.
In the scientific literature, there are no methods of the use as the basic foundation of module bb of the numbers, which are products of primes numbers or powers of such prime numbers, at using of which the pitch for X will be non-uniform, and estimates of the value of Z(N, bb).Such idea was proposed by the authors in papers [19][20][21], where the values of bb were determined from the condition of ensuring the lowest possible reduction in the number of admissible X, and the impact of the number of N on the number of admissible X in (5) at b=bb was not assessed.Such research is one of the problems that are being solved.
The hardware capabilities of calculations, such as graphic charts have considerably increased lately.While the algorithm of the Fermat method is easy to de-parallel, the task of number factorization could be performed using graphic processors.However, the types of data that are currently used in them do not imply the possibility of working with multidigit numbers.The methods for performing operations with numbers of long type instead of similar operations with big numbers are one of the most important tasks that are important when designing modifications of the Fermat algorithm.
That is why it is advisable to conduct studies regarding the use of the basic foundation of the module in ratios (5) both in terms of achieving a significant reduction in the number of admissible X, and for reducing computational complexity of the operations of multiplication and addition of multidigit numbers based on the operations with numbers of the long type.

The aim and objectives of the study
The aim of this study is to ensure the reduction of computational complexity of the algorithm of the Fermat method of factorization of big numbers using the basic foundation of the module that is the product of powers of prime numbers.This will make it possible to design hardware-software means of conducting cryptanalysis ACA that are more effective in terms of performance speed and, consequently, to enhance the quality of evaluation of crypto-resistance of ACA of RSA.
To accomplish the aim, the following tasks have been set: -to establish what prime numbers (multipliers bb) influence the value of acceleration coefficient Z(N, bb) at a fixed N, determined according to (6); -to find out how the values of Z(N, bb) are influenced by numbers N; -to offer the method to reduce the number of operations of multiplication and addition of multidigit numbers based on using the operation with the numbers of the long type when performing arithmetic operations with big numbers.

Analysis of influence of number N and exponents of prime numbers in the structure of basic foundation
The results of research into the impact of number N and powers of prime numbers in the structure bb were derived based on conducting numerical experiments.Analysis and generalization of the results are given below.
A general idea of the change in acceleration coefficient at changes of bb and a fixed value of N can be obtained based on the data of Tables 1, 2, which show the information for all Nmodbb<60, coprime with 2, 3 and 5.

Table 1
Value of acceleration coefficients Z(bb, Nmodbb) for various bb as products of number 60 on powers of 2, 3 and 5 for values of Nmodbb<60 coprime with 2, 3 and 5  Based on an analysis of data from Tables 1, 2, it is possible to draw two major conclusions: -at a change in bb, acceleration coefficient varies depending on the value of an additional multiplier in it; -acceleration coefficients take a series of the same values for a set of magnitude of Nmodbb, which at various bb is different.
Thus, at the increase in bb by 3 times (bb=180), acceleration coefficient increases either by three times, or remains unchanged.Аt an increase in bb by 9 times (bb=540), acceleration coefficient increases either by 4.5 times, or remains unchanged.In this case, an increase takes place for the same Nmod3 as at bb=180.If bb increases by 5 or by 25 times, acceleration coefficient also increases for the same Nmod5.The increase in bb by 2 с1 *3 с2 *5 с3 times leads to an increase in acceleration coefficient that is equal to the product of accelerations, related to an increase in bb of the exponent of number 2 by с1, of the exponent of number 3 by с2 and the exponent of number 5 by с3.
Thus, we can assume that for multipliers bb equal to p t , it is possible to determine a set of values Nmodp, for which the values of acceleration coefficients do not change at the change of exponent, and those for which they change.This assumption was checked using numerical experiments for multipliers bb -prime p from p=2 to p=31.The results of such research are given below.а) Multiplier bb р=2.Based on numerical experiments, it was found that for 2 t , it is advisable to use the value of exponent t³2, since at t=1, Nmod2 of acceleration is equal to 1. Table 3 shows the values of acceleration coefficients for all odd values of Nmod2 t at t=3÷7 that are coprime with bb.
Based on data from Table 3, it is possible to make a conclusion that the character of a change in the values of acceleration coefficients for bb=2 t at t>3 is determined by magnitude of residue Nmod8, which was proved by additional numerical experiments with bb=2 t at t≤14.For such values of bb at t=1÷14, Table 4 shows the values of acceleration coefficients depending on Nmod8.According to data from Table 4, the magnitude of acceleration coefficient for bb=2 t at t>2 is determined by exponent t and the value of Nmod8.This is proved by the data in Table 3 at t=3¸7, where, for example, at t=7 and Nmod8=1 acceleration coefficients for values of Nmod2 7 , equal to 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97, 105 and 113 will be the same (equal to 32/3), that is, for those that (Nmod2 7 )mod8=1.That is why the data from Table 4 allow estimating the constructions of the effective primary base bb for the cases when there is number 2 among prime multipliers bb.Thus, at Nmod8=3 and Nmod8=7 at bb=2 t and t≥3, acceleration coefficient always equals to 4 and there is no point using power 2 with the exponent higher than 3 in bb.If Nmod8=5, it will be optimal to use power 2 with exponent 5 in bb.But if Nmod8=1, it is possible to use power 2 with exponent 8 and more in bb.
b) Multiplier bb р=3.In case multiplier 3 is included in bb, it was found that at Nmod3=2, the values of acceleration coefficients for bb=3 t at t³1 coincide, which is proved by numerical experiments with bb=3 t at t=1¸8.For such values of bb, Table 5 gives values for acceleration coefficients, depending on Nmod3 at t=1¸8.Table 3 Acceleration coefficients Z(bb, Nmodbb) for odd Nmod2 t at t=3¸7 bb Acceleration Z=Z(bb, Nmodbb) for all possible values of Nmodbb According to Table 5, it is possible to estimate the possibilities of construction of the effective primary base of bb for cases when there is number 3 among prime multipliers.Thus, at Nmod3=2 at bb=3 t and t>0, acceleration coefficient always equals to 3.There is no point using power 3 with the exponent higher than 1 in bb.If Nmod3=1, it is possible to use power 3 with exponent 4 and more in bb.Based on data from Table 6, it is possible to assess more accurately the possibilities of the effective primary base of bb for the cases when there is number 5 among prime multipliers Thus, at Nmod5=2 or Nmod5=3 at bb=5 t and t>0 (5 , mod5) 2.5.
That is why it is advisable to use exponent t=1.If Nmod5=1 and Nmod5=4, it is possible to use in bb power 5 with exponent 2 and more.d) Multiplier bb р=7.If multiplier 7 is included in bb, it was found that the values of acceleration coefficients for bb=7 t at t³1 coincide for all Nmod7=3, Nmod7=5 and Nmod7=6, which was proved by numerical experiments with bb=7 t at t=1¸3.But at t>1 and Nmod7=1 Nmod7=2 and Nmod7=4, the value of acceleration coefficient increases and takes the same value.For such values of bb, Table 7 shows the acceleration coefficients depending on Nmod7 at t=1¸4.
Based on data from Table 7, it is possible to assess the possibilities of constructing the effective primary base of bb for the cases when there is number 7 among prime multipliers of bb.Thus, at Nmod7=3, Nmod7=5 or Nmod7=6 at bb=7 t and t>0, acceleration coefficient is always equal to 2.3333.That is why there is no point using in bb power 7 with exponent more than 1.If Nmod7=1, Nmod7=2 or Nmod7=4, it is possible to use in bb power 7 with exponent 2 and more.We will show on the examples of numbers N, presented in Table 9, that taking into consideration the specifics of numbers N, namely, the residues of dividing N by 8 and by prime p from 3 to 23, makes it possible to construct a new bb, at which set D(bb, N) will contain the number of admissible X, which does not exceed its value for bb=277200, equal to 2880 cells of memory of type int.The primary foundation for bb=277200 is the product of powers of prime numbers 2, 3, 5, 7, 11: bb=2 4 *3 2 *5 2 *7*11 and is characterized by the value of acceleration coefficient for numbers N of magnitude of 96.25, shown in Table 9.According to the data given in Tables 4-8, we will construct new, more effective bb¢.The data are shown in Table 9.
Taking into consideration the above recommendations on the selection of exponents of prime p -multipliers bb, Table 10 gives the refined values of bb ³ , which take into account the specificity of factorized number N.

Table 9
Values of N j modp for p=2 3 =8 and prime p=3¸23  As it follows from data in Table 10 for refined bb¢, due to taking into account the specificity of number N, the amount of required memory of the computer decreased and the value of the acceleration coefficient simultaneously increased by 3.25÷5.091times, which approximately reduces factorization time by the same number of times.That is why it is advisable to consider the problem of searching for the optimal bb that takes into consideration the specificity of numbers N.

Determining the optimal primary foundation of bb taking into account the specificity of the factorized number
When setting the problem of searching for the optimal primary base of module bb, we will use the information about the structure of bb, about the properties of acceleration coefficients and the number of elements of set D(bb, Nmodbb): the number of elements of array D(bb, Nmodbb) is equal to: 1 / ( , ) / ( , ).
According to ( 9) to (11), to determine bb, it is sufficient to determine the exponents of prime numbers -multipliers bb, where it is necessary to consider the relationship between the value of a prime number and an increase in acceleration at an increase in the exponent.For prime p from 2 to 23, the corresponding values of acceleration coefficients are determined according to data from Tables 4-8.When setting the task of searching for optimal bb with consideration of N, we will explore the possible types of the variants of values of exponents, depending on p, among which there will be an option when multiplier p is not used in bb and then z(p 0 , N)=1.
For p=2, three types of variants are possible: 1) at Nmod8=3 or Nmod8=7, exponent t is always equal to 3; 2) at Nmod8=5, exponent t is always equal to 5; 3) at Nmod8=1, it is necessary to determine the value of exponent t.
Thus, when choosing the exponent of prime p -multiplier of bb, the exponent is not determined only for the third variant.To assess the possible range of exponents in variant 3, we will use the function of relative increase in acceleration coefficient, reduced to a memory unit: which makes it possible to give an approximate estimate of the effectiveness of the primary base of module, related to additional multiplying bb by prime multiplier р.The values of function s(p, t) for prime р³2 and р≤31 for the series of variants of exponent are shown in Table 11.
Sorting values s(p, t) in the descending order makes it possible to assess how effective the addition of multiplier p in bb will be.The more s(p, t), the higher the effectiveness.If s(p, t) is close to zero, at an increase in bb, acceleration coefficient increases slightly, but the amount of memory of a computer used to store increments for admissible X increases significantly.To search for the optimal bb taking into consideration the specificity of N and the methods for reducing computer memory, ratios (9) to (11) and limitations for the memory amount of the computer are used.The search for a maximum acceleration coefficient is through the search of admissible options of exponents of prime p -multipliers N.
In the numerical calculations on determining the optimal bb with consideration of the admissible memory amount needed to store increments of admissible X, it was accepted that the primary base of module bb is the product of powers -for р=2 by Nmod8, we selected one of the possible types of variants, where in case if Nmod8=1, exponents of t=3¸12 were considered; -for p≥3 and p£31, two type of variants were selected: type 2 as well as one of the types 1 or 3, depending on the value of Nmodp.
In addition, when determining the required memory amount of the computer, it was taken into account that bb is always divided into 4, that is, the cyclic sequence of increments for bb is repeated at least twice.
In the numerical experiments for memory amount (magnitude Q max ) 10 2 , 10 3 , 10 4 , 10 5 , 10 6 , 10 7 , for each of the variants of the influence on acceleration coefficients, the maximum value of acceleration coefficient was determined.Since the number of such variants turns out to be quite large (equal to 3*2 8 =768), Table 12 shows the data only about Z min , Z max , and mean Z ср , which is equal to the mean value for all the variants, where coefficient 2 is assigned for reaching the equality of the variants at p=2 and the type of variant 1, and coefficient 1 is given for variants 2 and 3. Then the weighted sum of all the obtained maximum acceleration coefficients was divided by 1,024.Derived values of Z min , Z max and Z ср were shown in Table 12 in the form of a diagram in Fig. 1.According to data from Table 12, when using the optimal values of the basic foundation of the module, determined from the condition of the existing memory volume of computer, which does not exceed 10 7 cells of the long type, the number of check X will decrease in comparison with the basic algorithm of the Fermat method by 2.4×10 3 ¸ ¸4.2×10 4 times, where the mean value equals to 1.1×10 4 times.The computational complexity of the basic algorithm of the Fermat method will decrease by the same number of times.Further reduction of computational complexity can be achieved by reducing the number of operations of multiplication and subtraction of the numbers that exceed boundary values for the long type, which is considered below.

A decrease in the number of arithmetic operations with the numbers that exceed boundary values for the long type data
The algorithm of the Fermat method implies two basic operations for the check X: calculation of difference X 2 -N and checking whether this difference will be the square of an integer.Based on using only the values X, which are admissible for bb, as check values, the number of check X decreased.However, this does not exclude performance of the operations of the calculation of difference 2 X N -and checking whether it will be the square of an integer.In addition, the roots of the equation ( 5) at b=bb can be big numbers, which can be seen in data from Table 12.That is why during the implementation of the modified algorithm of the Fermat method, it is proposed: 1. To use increments -differences of two nearest values of the roots of the equation ( 5) instead of the roots of the equation ( 5) at b=bb.
2. For each of the foundations of the modules of set to determine the roots of equation ( 5) at b=b k (k=1¸m) and form array M K of features for numbers from 0 to b k -1, in which 1 will mean that ( ) is the square residue, but zero, which is not true.
The first proposal makes it possible to represent the current admissible for bb check Х in the form of: where X i+1 (X i ) is the following (previous) check Х, admissible for bb; Dx i is the increment for current admissible Х; X * is some intermediate fixed value, admissible for bb, which changes when magnitude DХ і is close to the boundary for the data of the long type.In such cases, we perform operations: X * =X * +DХ і , DХ і =0, as well as calculate residues s k =X*modb k (k=1¸m).
Another proposal makes it possible to significantly decrease the number of operations of root calculation in relation to the basic algorithm of the Fermat method.To do this, in assessing the possibility that difference 2 X N -can be complete square, the values are calculated * , mod ( )mod where the sum k i s X + D is the number of the long type, and numbers r k,i are smaller than b k .It allows finding value  Under condition that value M K [r k, i ]=1 for all k=1¸m, we calculate square root of 2  .X N -At this algorithm, the calculation of the value of check Х (multidigit number) is performed in two cases: -during calculation of the root of 2 X N -, when 2 ; X N is calculated; -during recalculation of X * =X * +DХ і , where DХ і is the number of the long type.
Since at a sufficient number of modules in set MB b = = the first variant occurs so rarely that it can be neglected, the computational complexity of the proposed modified algorithm is determined by the operations of assigning value X * +DХ і to X * , where DХ і is a long type number and by calculations of residues s k =X*modb k (k=1¸m).
When presenting multidigit numbers by its coefficients for the base 1,000 or 1,024, during calculating the value of X * +DХ і , on average 4÷5 operations of addition the numbers of long type and 8÷10 operations of division of the sum by the foundation will be performed.We will estimate how often the cases of computation of values X * +DХ і occur.The mean value of increments Dx i is estimated by the magnitude of acceleration coefficient.If we use the optimal values of bb, obtained at restrictions for the amount of available memory of the computer of the order of 10 7 cells of the long type, it is possible to reach the magnitude of the boundary value of the number of long type (»2.147×10 9 ) by the number of steps in the range from 50,000 to 900,000, where the average number of steps is equal to 2.147×10 9 /11,088.624»193,630.Now we will estimate the average number of operations with numbers of long type for values of N close to 2 1024 , performed in the proposed modified Fermat method at the number of check values for its basic algorithm, equal to 2.147×10 9 , when computation complexity of calculation operations 2  X N -and the root from 2 X N -can be neglected.For the modified algorithm of the method, we have: 1.One operation X * +DХ і ; on average 4-5 operations of addition of the numbers of the long type and 8-10 operations of dividing the sum by the foundation will be performed.
2. During performing operation X * +DХ і one time, we calculate the values of where numbers s k , DХ і and the sum sk+DХ і do not go beyond the boundaries of data of long type.That is the summary number of operations of m additions and m calculations of residues ( )mod ( 1 ).
Primary values of ( 1) are calculated before the entrance of check values X to the main cycle of the search of admissible values for bb and are not taken into account here.
3. On average, around 1.95×10 5 operations DХ і =DХ і-1 + +Dx i , each of which is performed for long type numbers, which during representations of multidigit numbers by the array of coefficients, during factorization by foundation 1,024 requires every time on average 2 operations of addition and division.
The total average number of operations with long type numbers at m<100: addition -around 4×10 5 , division and determining residue of division -around 4×10 5 , which is approximately equal to 2×2.147×10 9 /Z(N, bb).
1. 2.147×10 9 operations of increasing X by unity, complexity of which will be neglected.
2. 2.147×10 9 operations calculate the value of 2 X N -.We will consider that due to the ratio Thus, on average, for one check value of X among 2.147×10 9 operations, the modified algorithm requires 2/Z(N, bb) operations of adding and dividing long type numbers (including division with residue), and the basic algorithm of the Fermat method -O(logN+log 2 N) operations.If we consider that the mean value of Z(N, bb) is equal to 1.1×10 4 , and N is close to 2 1024 , computational complexity of the modified algorithm of the Fermat method decrease not less than by 10 7 times.

Discussion of results of reducing the computational complexity of the modified algorithm of the Fermat factorization method
An analysis of the factors that essentially influence computational complexity of the algorithm of the Fermat factorization method and its modifications revealed that they may include: а) a relative number of values of k in the ratio (2), at which it is possible to establish beforehand that ( ) 2 0 x k N + -will not be square of an integer (mean value is (z(N,bb)-1)/z(N,bb)); b) a relative number of values of k in the ratio (2), at which based on checking the ratios (4) for a series of foundations of modules, it is possible to establish that ( ) 2 0 x k N + -will not be the square of integer (mean value is (1/z(N, bb)*(1-2 -m ), where m is the number of integers in coprime modules that are used in the ratios (4)); c) a relative number of values of k in the ratio (2), at which if the ratios (4) for the selected set of values of foundations of modules are satisfied, it should be checked it multidigit number ( ) 2 0 x k N + -will be the square of the integer based on calculation of the root from it (mean value is equal to (1/z(N, bb)*2 -m , where m is the number of prime numbers in coprime modules, which are used in the ratios (4)); d) a relative number of steps of the algorithm, at which it is necessary to perform operations with multidigit numbers.
The studies, the results of which are presented in the article, were directed at achieving maximum values for the factor a) (that is, a maximum value of acceleration coefficient z(N, bb)), as well as the smallest possible number of steps, at which the operations with multidigit numbers (factor g) are performed.
To obtain maximum values of accelerated coefficient, we found the ratio (10) for z(N, bb) and (11) for the amount of memory required to store the increments to admissible X as the difference between their two consecutive values (in ascending order).Based on them, we stated the problem of determining the optimal primary foundation of bb with consideration of specificity of the factorized number, in which one of the conditions is a restriction for the amount of avail-able computer memory.The use of increments to admissible X instead of their values made it possible to replace most of the operations, which in the algorithm of the Fermat method are performed with multidigit numbers, with the operations with long type numbers.It is possible to solve the challenges, represented in section 2.
It should be noted that in the modified algorithms of the Fermat method, presented in [9], the problems concerning factor b) are solved.
The amount of available memory of a computer (or distributed computing systems) is the main constraint in practical use of the proposed modified Fermat algorithm, because the following problems are solved based on this information: -determining the optimal primary foundation of bb taking into consideration the specificity of N, which corresponds to maximum value of z(N, bb); -determining a set of foundations of modules that are used to check the ratios (4), where the information about square residues is stored for each of the foundations.
The restrictions can also include the fact that at z(N, bb)>1000, its increase by two times is possible, as a rule, when a new integer appears in bb.And since bb is the product of powers of prime numbers, it is impossible in practice to obtain acceleration coefficients Z max >10 7 , let along Z min >10 7  or Z ср >10 7 .
The presented solutions and the general algorithm of the modified Fermat algorithm were focused at the possibilities of their use both for single-processor computers, and for modern high performance distributed computation systems.In the latter case, it is important to take into consideration the amount of available memory for each of the processors, which was not explored in the study.
Methods of factorization of multidigit numbers can be considered as an iteration procedure, by which the satisfaction of a certain condition is checked at the check step k.In the case of the Fermat method, the condition is checked if the difference ( ) 2 0 x k N + -will be the square of an integer.In this case, it was found for the Fermat method, that it is not necessarily to determine the square root of (the conditions of factor c)), and in most cases it is enough to use the algorithms of thinning check values (factors a) and b)).It is possible to set the task of finding the ways to use this idea for other factorization methods as well.However, in the case of each of the factorization methods, it is necessary to iden-tify conditions that should be checked and find the ways of thinning the check k.

Conclusions
1.It was established that powers of prime numbersmultipliers of bb form an integral of acceleration coefficient, which does not depend on other prime numbers or powers of such numbers, and total acceleration coefficient Z(N, bb) at a fixed N is the product of such coefficients for powers of prime numbers.
2. Based on numerical experiments, it was found that depending on residues of dividing N by prime numbersmultipliers N, for each of the prime numbers p, sets Nmodp are formed, for which at the fixed bb, acceleration coefficient Z(N, bb) takes one and the same value.For prime numbers p from 3 to 31, it was shown based of numerical experiments that there are only 2 groups of values Nmodp.For the first of them, containing the values Nmodр=1, inequality Z(N, p 2 )>Z(N, p) is true, and for the second one, equality Z(N, p k )=Z(N, p), where k>1 is true.Three groups are formed for powers of prime p=2: 1) Nmod8=1; 2) Nmod8=5; 3) Nmod8=3 and Nmod8=7.Then, Z(N, 2 5+k )>Z(N, 2 5 ) for variant 1, Z(N, 2 5+k )=Z(N, 2 5 ) for variant 2, Z(N, 2 3+k )=Z(N, 2 3 ), where k>0 for variant 3.This made it possible to significantly reduce the number of possible variants of values of bb while solving the problem of determining its optimal value.
3. When using large values of basic foundation of module, it proved to be appropriate to represent the roots of the equation (5) through the difference between two consecutive values (in ascending order).This made it possible in most cases to perform operations with long-type numbers instead of multidigit numbers.
4. Based on the obtained results, we described the modified algorithm of the Fermat method, which in comparison with the basic algorithm ensures the reduction of computational complexity on average no less than by 10 7 times for the numbers of 2 1024 order when using the optimal values of Z(N, bb), provided that it is possible to record up to 10 7 of the long-type numbers in the computer memory.

Fig. 1 .
Fig. 1.Values of acceleration coefficients Z(bb) at limitations for amount Q (max) of available memory for the current check Х the difference 2 X N -cannot be a complete square and the transition to a new check Х, admissible for bb, is performed.At M K [r k, i ]=1, a similar magnitude for k+1-th module from set 1 { } m k k MB b = = .

Table 5 Z
(3 t, Nmod3) for coprime with 3 Nmod3 at bb=3 t and t=1¸8 If multiplier 5 is included in bb, it was found that the values of acceleration coefficients for bb=5 t at t³1 coincide for all Nmod5=2 and Nmod5=3, which was proved by the numerical experiments with bb=5 t at t=1¸6.But at t>1 and Nmod5=1 and Nmod5=4, the value of acceleration coefficient increases.Such value at every t is the same at Nmod5=1 and Nmod5=4.For such values of bb, Table6shows the values of acceleration coefficients, depending on Nmod5.

Table 7
Acceleration coefficients for Nmod7, coprime with 7 For prime р -multipliers of bb, equal to 11, 13, 17, 19, 23, it was found that the character of a change in the values of acceleration coefficients for bb=р t at t³1 is determined by the value of Nmodр, which was proved by numerical experiments with bb=р t at t=1¸4.For such values of bb, Table8shows the values of acceleration coefficients, depending on Nmodр at t=1, 2.

Table 10
Refined primary foundations of bb ¢ , formed for numbers N with respect to data from Tables4-6

Table 11
Values of function s(p, t) for prime р³2 і р≤31 equal to 2,3, 5, 7, 11, 13, 17, 19, 23 29,  31, where the set of options of exponent of prime numbers p -multipliers bb is selected based on the data from Tables 5-8 and 11 on condition that s(p, t)>0.03(t is an exponent for p).In this case, the following options of the influence on acceleration coefficient: