Classical Shor’s Algorithm Versus J. M. Pollard’s Factoring with Cubic Integers

We tried to factor the following numbers with each algorithm: 11^3+2, 2^33+2, 5^15+2, 2^66+2, 2^72+2, 2^81+2, 2^101+2, 2^129+2, and 2^183+2. Shor’s algorithm fully factored all of the numbers. Factoring with cubic integers fully factored all numbers except 2^66+2, 2^71+2, 2^129+2, and 2^183+2.

cs1cubiccs1shor

cs2cubiccs2shor

cs3cubiccs3shor

cs4cubiccs4shor

cs5cubiccs5shor

cs6cubiccs6shor

cs7cubiccs7shor

cs8cubiccs8shor

cs9cubiccs9shor

Typical full output from factoring with cubic integers:

A-Solutions = 973
B-Solutions = 234
Known Eqs = 614
Solutions = 1821
Rows = 1821
Columns = 1701
Kernel rank = 423
Sieved = 326434
Successes0 = 200863
Successes1 = 47073
Successes2 = 2708
Successes3 = 973
Successes4 = 1735

2417851639229258349412354 - 25 DDs

2 p
65537 p
414721 p
44479210368001 p

Sets = 189
#Factor Base 1 = 501
#Factor Base 2 = 868

FactB1 time = 00:00:00.000
FactB2 time = 00:00:05.296
Sieve time  = 00:00:17.261
Kernel time = 00:00:06.799
Factor time = 00:00:02.327
Total time  = 00:00:31.742

A-solutions have no large prime. B-solutions have a large prime between B0 and B1 exclusively which is this case is between 3272 and 50000 exclusively. The known equations are between the rational primes and the cubic primes and their associates of the form p = 6k + 1 that have -2 as a cubic residue. There are 81 rational primes of the form and 243 cubic primes but we keep many other associates of the cubic primes so more a and b pairs are successfully algebraically factored. In out case the algebraic factor base has 868 members. The rational prime factor base also includes the negative unit -1. The kernel rank is the number of independent columns in the matrix. The number of dependent sets is equal to columns – rank which is this case 1701 – 423 = 1278. The number of (a, b) pairs sieved is 326434. Successes0 is the pairs that have gcd(a, b) = 1. Successes1 is the number of (a, b) pairs such that a+b*r is B0-smooth or can be factored by the first 500 primes and the negative unit. r is equal to 2^27. Successes2 is the number of (a, b) pairs whose N[a, b] = a^2-2*b^3 can be factored using the norms of the algebraic primes. Successes3 is the number of A-solutions that are algebraically and rationally smooth. Successes4 is the number of B-solutions without combining to make the count modulo 2 = 0. Successes3 + Successes4 should equal Successes2 provided all proper algebraic primes and their associates are utilized.

Note factoring with cubic integers is very fickle with respect to parameter choice.

Cubic Integers

The following text is based upon Appendix 5 “Higher Algebraic Number Fields” found in the book “Prime Numbers and Computer Methods for Factorization” by Hans Riesel. Cubic integers are algebraic numbers of the form [a, b, c] which is a short hand for a + b * z + c * z * z where z is the cube root of -2. we have z * z * z = z ^ 3 = -2 and z ^ 4 = -2 * z. The numbers a, b, and c are rational integers in Z. The product of two cubic integers is also a cubic integer (expansion of equation A5.8):

[a, b, c] * [d, e, f] = (a + b * z + c * z * z) * (d + e * z + f * z * z) = a * d + a * e * z + a * f * z * z + b * d * z + b * e * z * z + b * f * z * z * z + c * d * z * z + c * e * z * z * z + c * f * z * z * z * z = a * d – 2 * b * f – 2 * c * e + (a * e + b * d – 2 * c * f) * z + (a * f + b * e + c * d) * z * z = [ a * d – 2 * b * f – 2 * c * e , a * e + b * d – 2 * c * f , a * f + b * e + c * d ]

The defining equation for z is z^3 + 2 = 0. The other two roots of the polynomial f(z) = z^3 + 2 are the complex conjugates z[2] = z * (-1 + i * SQR(3)) / 2 and z[3] = z * (-1 – i * SQR(3)) / 2, where SQR(x) is the square root function such that x = SQR(x) * SQR(x) and i = SQR(-1), the imaginary unit. z[2] and z[3] are complex numbers of the form w = u + i * v, where u is the real part and v is the imaginary part. Let o = (-1 + i * SQR(3)) / 2. z[2] = o * z and z[3] = o * o * z.

Q(z) is a field and the integers of the field form Z(z) which is a ring. The norm of the cubic integer [a, b, c] is (expansion of equation A5.7):

N[a, b, c] = (a + b * z + c * z * z) * (a + b * o * z + c * o * o * z * z) * (a + b * o * o * z + c * o * z * z) = a ^ 3 – 2b ^ 3 + 4 * c ^ 3 + 6 * a * b * c

I wrote a computer application in C# to recreate the results of Appendix 5. Below is a screen shot of the application’s form:

riesel

I reproduce the units table of page 300 below:

Positive Units

[        1,        0,        0,        1]              1
[ 1, 1, 0, 1] -1
[ 1, 2, 1, 1] 1
[ -1, 3, 3, 1] -1
[ -7, 2, 6, 1] 1
[ -19, -5, 8, 1] -1
[ -35, -24, 3, 1] 1
[ -41, -59, -21, 1] -1
[ 1, -100, -80, 1] 1
[ 161, -99, -180, 1] -1
[ 521, 62, -279, 1] 1
[ 1079, 583, -217, 1] -1
[ 1513, 1662, 366, 1] 1

Negative Units

[       -1,        0,        0,       -1]             -1
[ -1, 1, -1, -1] -1
[ 5, -4, 3, -1] 1
[ -19, 15, -12, -1] -1
[ 73, -58, 46, -1] 1
[ -281, 223, -177, -1] -1
[ 1081, -858, 681, -1] 1
[ -4159, 3301, -2620, -1] -1
[ 16001, -12700, 10080, -1] 1
[ -61561, 48861, -38781, -1] -1
[ 236845, -187984, 149203, -1] 1
[ -911219, 723235, -574032, -1] -1
[ 3505753, -2782518, 2208486, -1] 1

The pertinent factorization of the cubic integer prime numbers less than 300 are given next:

Case 1

[        1,        0,        1,        5]              5
[ -1, -1, 1, 11] 11
[ 1, -2, 0, 17] 17
[ 3, 0, -1, 23] 23
[ 3, -1, 0, 29] 29
[ 1, -3, 1, 41] 41
[ 3, 1, 1, 47] 47
[ -1, -3, 0, 53] 53
[ 3, 0, 2, 59] 59
[ -1, -2, 2, 71] 71
[ 3, -2, -2, 83] 83
[ 1, -2, 3, 89] 89
[ -3, -4, 0, 101] 101
[ -1, 0, 3, 107] 107
[ 1, -4, 2, 113] 113
[ 3, -3, -1, 131] 131
[ -3, -1, 3, 137] 137
[ 1, -4, -1, 149] 149
[ -3, -3, 2, 167] 167
[ 3, -5, 4, 173] 173
[ 5, -3, 0, 179] 179
[ -1, 2, 4, 191] 191
[ 5, -2, -1, 197] 197
[ 3, 2, 3, 227] 227
[ 5, 0, 3, 233] 233
[ 1, -3, 4, 239] 239
[ 1, -5, 0, 251] 251
[ 1, 0, 4, 257] 257
[ 3, -4, -3, 263] 263
[ 1, -5, 3, 269] 269
[ -1, -1, 4, 281] 281
[ -3, -6, -1, 293] 293

Case 2

[       -1,        0,        2,       31]             31
[ 3, 0, 1, 31] 31
[ -1, -2, 1, 31] 31
[ 1, 1, 2, 43] 43
[ 3, -1, -1, 43] 43
[ 3, -2, 0, 43] 43
[ 1, 0, 3, 109] 109
[ 1, -4, 1, 109] 109
[ 5, 2, 0, 109] 109
[ -1, -4, 0, 127] 127
[ -1, -1, 3, 127] 127
[ 5, -1, 0, 127] 127
[ 5, 1, 1, 157] 157
[ 5, 0, 2, 157] 157
[ 3, -3, -2, 157] 157
[ 3, -4, -1, 223] 223
[ -3, -5, 0, 223] 223
[ 1, -5, 2, 223] 223
[ -1, 1, 4, 229] 229
[ -3, 0, 4, 229] 229
[ 5, -2, -2, 229] 229
[ 1, -5, -1, 277] 277
[ 3, -5, 0, 277] 277
[ -3, -4, 2, 277] 277
[ -1, -5, 1, 283] 283
[ 3, 0, 4, 283] 283
[ 5, 3, 2, 283] 283

Case 3

[        0,        1,        0,        2]             -2

Case 4

[       -1,        1,        0,        3]             -3

I reproduce the factorization of the norms of [a, b, 0] found on page 303 are given below:

[       59,       46,        0,        1]          10707
[ -1, -2, -1, 1] -1
[ -1, 1, 0, 3] -3
[ 1, 1, 2, 43] 43
[ 3, -2, -2, 83] 83

[ 59, 48, 0, 1] -15805
[ -1, 3, 3, 1] -1
[ 1, 0, 1, 5] 5
[ 3, -1, 0, 29] 29
[ 1, -4, 1, 109] 109

[ 61, 48, 0, 1] 5797
[ 1, -3, -3, 1] 1
[ -1, -1, 1, 11] 11
[ 1, -2, 0, 17] 17
[ 3, 0, 1, 31] 31

[ 62, 47, 0, 1] 30682
[ 1, 1, 0, 1] -1
[ 0, 1, 0, 2] -2
[ 3, 0, -1, 23] 23 ^ 2
[ 3, -1, 0, 29] 29

[ 62, 49, 0, 1] 3030
[ 1, -3, -3, 1] 1
[ 0, 1, 0, 2] -2
[ -1, 1, 0, 3] -3
[ 1, 0, 1, 5] 5
[ -3, -4, 0, 101] 101

[ 63, 50, 0, 1] 47
[ 19, 5, -8, 1] 1
[ 3, 1, 1, 47] 47

[ 64, 47, 0, 1] 54498
[ -1, -1, 0, 1] 1
[ 0, 1, 0, 2] -2
[ -1, 1, 0, 3] -3
[ -1, 0, 2, 31] 31
[ -3, -6, -1, 293] 293

[ 65, 53, 0, 1] -23129
[ 1, 1, 0, 1] -1
[ -3, -4, 0, 101] 101
[ -3, 0, 4, 229] 229

[ 66, 53, 0, 1] -10258
[ 1, 2, 1, 1] 1
[ 0, 1, 0, 2] -2
[ 3, 0, -1, 23] 23
[ 3, -4, -1, 223] 223

[ 67, 53, 0, 1] 3009
[ 7, -2, -6, 1] -1
[ -1, 1, 0, 3] -3
[ 1, -2, 0, 17] 17
[ 3, 0, 2, 59] 59

[ 1693, 749, 0, 1] 4012180059
[ -1, -2, -1, 1] -1
[ -1, 1, 0, 3] -3
[ 3, -2, 0, 43] 43
[ 5, 0, 2, 157] 157
[ 7, -3, 0, 397] 397
[ 5, 1, 4, 499] 499

The last factorization is from “The Development of the Number Field Sieve” edited by A. K. Lenstra and H. W. Lenstra, Jr. containing the paper “Factoring with Cubic Integers” by J. M. Pollard page 10.

 

Classical Shor’s Algorithm

Shor’s algorithm is a fast method of factoring integers using a quantum computer:

https://en.wikipedia.org/wiki/Shor%27s_algorithm

I have implemented the algorithm classically and performed a few experiments on integers greater than equal 12. I used Floyd’s cycle finding algorithm as implemented with a randomized Pollard’s Rho Factoring method using two second degree polynomials:

https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm

I factored the seventh Fermat number in less than nine minutes. J. M. Pollard factored this number in 20.1 hours in 1988 using the special number field sieve [see “Lecture Notes in Mathematics 1554 The Development of the Number Field Sieve” edited by A. K. Lenstra and H. W. Lenstra, Jr. The paper by Pollard is entitled “Factoring with Cubic Integers”]. Both Pollard and I used personal computers.

Suppose Moore’s original law is applied to Pollard’s factoring of the seventh Fermat number and also assume computing time is cut in half every two years then we can compute the following table:

A less optimistic table states that the computation time is halved every four years:

I successfully factored 38 of 39 numbers of the form 12, 123, 1234, 12345, … , 1234567890123456789012345678901234567890. The results of my factoring C# Windows form application are displayed below:

I was eventually able to factor the 38-decimal digit number that failed in the above calculation as illustrated below:

The number of bits per number varied from 4-bits to 130-bits. This is still no where near the ability to factor a 3,000-bit Rivest-Shamir-Adleman composite integer so most financial systems remain secure. The link below will take you to the Microsoft C# project directory on my OneDrive account.

https://1drv.ms/f/s!AjoNe9CiN2M9gfMbQ8H_g3GMQEC6iA

The C# source code is at the preceding link in a printable and readable PDF.

Global Primary Greenhouse Gas Concentrations by James Pate Williams Jr BA, BS, MSwE, PhD

I designed and implemented a C# computer language application to model the global greenhouse gas concentrations data found on the NOAA website:

https://www.esrl.noaa.gov/gmd/aggi/aggi.html

I used the latest recommended data for time period 1979 to 2017. The concentrations of three greenhouse gases were modeled: carbon dioxide (CO2), methane (CH4), and nitrous oxide (N2O).

The empirical modeling paradigm I used was simple linear regression. My model goes out to the year 2300. The key formulas used by the model are:

                                Simple Linear Regression Parameters

See the website:

https://en.wikipedia.org/wiki/Simple_linear_regression

Some plots of the concentrations in parts per million (PPM) and parts per billion (PPB) are given below.

                                                Carbon Dioxide Concentration in Parts Per Million
                                                        Methane Concentration in Parts Per Billion
                                                 Nitrous Oxide Concentration in Parts Per Billion
                                             Carbon Dioxide Concentration in Parts Per Million
                                                      Methane Concentration in Parts Per Billion
                                                   Nitrous Oxide Concentration in Parts Per Billion
              Simple Linear Regression Parameters
              Simple Linear Regression Parameters
             Simple Linear Regression Parameters
                                                         Greenhouse Gas Concentrations Table

NOAA Contiguous United States of America Precipitation by James Pate Williams Jr BA, BS, MSwE, PhD

I designed and implemented a C# computer language application to model the precipitation data found on the NOAA website:

https://www.ncdc.noaa.gov

I used the latest recommended data for time period 1895 to 2017. The empirical modeling paradigm I used was simple linear regression. My model goes out to the year 2300. The key formulas used by the model are:

Simple  Linear Regression Equations

See the website:

https://en.wikipedia.org/wiki/Simple_linear_regression

Some plots of the contiguous U.S. precipitation are shown below. The climate is getting wetter thus some parts of the U.S.maybe more prone to floods.

Precipitation Plot
Precipitation Plot
Precipitation Plot
Precipitation Plot
Precipitation Plot
Precipitation Plot
Precipitation Plot
Simple Linear Regression Parameters
Precipitation Table Experimental and Theoretical Values

NOAA Contiguous United States of America Temperature Anomaly by James Pate Williams Jr BA, BS, MSwE, PhD

I designed and implemented a C# computer language application to model the temperature anomaly data found on the NOAA website:

https://www.ncdc.noaa.gov

I used the latest recommended data for time period 1895 to 2017. The empirical modeling paradigm I used was simple linear regression. My model goes out to the year 2300. The key formulas used by the model are:

Simple Linear Regression Equations

See the website:

https://en.wikipedia.org/wiki/Simple_linear_regression

Below are some plots of the temperature anomaly.

Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
Temperature Anomaly Actual Anomaly in Red Theoretical in Blue
C# Application Main Form
Simple Linear Regression Parameters
Table Function Form with Experimental and Theoretical Anomalies

The Laplace Equation in Various Orthogonal Rectilinear Coordinate Systems James Pate Williams, Jr. BA, BS, MSwE, PhD

Solve the Laplace equation in the following orthogonal rectilinear coordinate systems:

  1. Cartesian coordinates
  2. Cylindrical coordinates
  3. Spherical polar coordinates
  4. Parabolic cylindrical coordinates

Solution PDF:

Laplace Equation

Four Techniques for One Dimensional Riemann Definite Integration by James Pate Williams, Jr. BA, BS, MSwE, PhD

The four methods considered in this study are as follows:

  1. Trapezoidal Rule
  2. Simpson’s Rule
  3. Gauss-Legendre Quadrature
  4. Monte Carlo Method

The trapezoidal rule requires (n  + 2) function evaluations, n real number increments, and six additional real number arithmetic operations. Simpson’s rule involves (n + 2) function evaluations, n real number increments, and ten additional real number arithmetic operations. Gauss-Legendre quadrature uses n function evaluations, 3 * n real number arithmetic operations, 2 * n index operations, and five additional arithmetic operations. Finally, the Monte Carlo Method requires n function evaluations, n random number generations, 2 * n + 3 additional real number arithmetic operations. The Gauss-Legendre quadrature also involves some complicated orthogonal polynomial operations to determine the abscissas and weights. Below are some results from our test C# application.

ResultsForm 10_25_2018 5_20_34 PMResultsForm 10_25_2018 5_21_14 PMResultsForm 10_25_2018 5_21_28 PMResultsForm 10_25_2018 5_22_26 PMResultsForm 10_25_2018 5_22_47 PMResultsForm 10_25_2018 5_23_05 PMResultsForm 10_25_2018 5_23_52 PMResultsForm 10_25_2018 5_24_19 PMResultsForm 10_25_2018 5_24_39 PM

We conclude from the preceding dearth of tests that for given n the order of accuracy is generally Gauss-Legendre, Simpson’s, Trapezoidal, and finally Monte Carlo.

ASP .NET AJAX Timer Demonstration by James Pate Williams, Jr. BA, BS, MSwE, PhD

Sometimes in a web application you want to time the user’s input. Suppose you have a one textbox web form and you want to set an inactivity timer of 1200 seconds which is equal to 20 minutes. Every time the user adds or modifies the textbox the timer is reset to 0. The following pictures tell the story of my implementation of such a server-side timer in ASP .NET using an AJAX timer object.

Microsoft Edge 10_13_2018 4_29_27 PMMicrosoft Edge 10_13_2018 4_29_48 PMMicrosoft Edge 10_13_2018 4_30_22 PMMicrosoft Edge 10_13_2018 4_31_27 PMMicrosoft Edge 10_13_2018 4_31_44 PMMicrosoft Edge 10_13_2018 4_51_20 PMMicrosoft Edge 10_13_2018 4_52_03 PMMicrosoft Edge 10_13_2018 4_52_25 PMMicrosoft Edge 10_13_2018 4_57_43 PM

AJAX Timer Demonstration Source Code

Calculating a Few Digits of the Transcendental Number Pi by Throwing Darts by James Pate Williams, BA, BS, MSwE, PhD

Suppose you have a unit square with a circle of unit diameter inscribed . You can compute a few digits of the transcendental number, pi, 3.1415926535897932384626433832795…, by using the algorithm described as follows. Let n be the number of darts to throw and h be the number of darts that land within the inscribed circle.

h = 0

for i = 1 to n do

Choose two random numbers x and y such that x and y are contained in the interval 0 to 1 inclusive that is x and y contained in [0, 1]

Let u = x – 1 / 2 and v = y – 1 / 2

if u * u + v * v <= 0.25 = 1 / 4 then h = h + 1

next i

pi = 4 * h / n

Below are the results of a C# Microsoft Visual Studio simulation project. In the first case we throw 100,000 darts and get two significant digits of pi and then we throw a 1,000,000 darts and five significant digits of pi are computed. Of course, in a previous entry by this author we can calculate hundreds or thousands of digits of pi in relatively little time:

https://jamespatewilliamsjr.wordpress.com/2018/07/01/the-bailey-borwein-plouffe-formula-for-calculating-the-first-n-digits-of-pi/

MainForm 10_16_2018 3_04_04 AMMainForm 10_16_2018 3_05_45 AMMainForm 10_16_2018 3_09_36 AMMainForm 10_16_2018 3_09_54 AM

MonteCarloPi Source Code