JAVASCRIPT PRIME NUMBER LISTS USING INTEGER FACTORING FAMILIES

Part Three: Basics of Integer Factoring

JB Johnson
14 min readApr 8, 2021
Simple is to complex
What complex is to simple,
Something unimaginable!
Prime and Factor List

Foreword

Lists of prime numbers can be produced using Integer Factoring Families and JavaScript code (or your own version of software poison.) This is accomplished by a brute force elimination and substitution routine. All integers greater than 2 that are found in a specific range are put in a list. Using the properties of Integer Factoring Families, all the integers that can be factored are removed from the list. The residue is a list of the prime numbers in that given range. No magic is required, just lots and lots (and lots) of simple but time consuming calculations.

Finding factors and primes was my original intent with the software, because I am always tinkering with some sort of factoring routine and I frequently need a list of factorable integers and a list of primes for testing. However, it took no time at all until I realized that I was creating Integer Factoring Families and I found them to be intriguing in their own right.

This article is part of the series called the Basics of Integer Factoring. If you view my About data, a list of all the other articles can be seen.

Chapter 1 — Background

The basics of Integer Factoring Families are discussed at:

https://jbjo1956.medium.com/introduction-to-integer-factoring-families-dce2152fba81?source=friends_link&sk=382a4fef0eac9c47673c550db9560761

In this article I will provide the code for one of the JavaScript software tools that I find useful in studying integer factoring and prime numbers. I will also provide some rudimentary instructions on how to control the beast.

Chapter 2 — How To Install

Transfer the JavaScript code by highlighting the contents of the code block in Appendix 2 and performing a copy. Create a text file, i.e. “Something-or-other.txt” and paste into the text file. I call mine “Families of Factors — Output Routine — JavaScript Code.” Now, rename the “.txt” file as “.html” and you are ready to create your own tables of Integer Factoring Families. Just click on it and bring up your browser. Have fun! (Diabolical laughing in the background.)

Actually, I wish it was that easy, but it is not. First, there are trivial yet frustrating details that may need to be resolved. What if the display window is not the right size for your computer? If you are experienced with editing text files, then you will find the code TEXTAREA NAME=”TheReport” and change the values of ROWS and COLUMNS to values that work better for you. Remember, you may want to make a backup copy of the file before you do code surgery.

The “.html” is not a text file. How can I edit it? Rename the “.html” file as “.txt” and edit it. Then rename the “.txt” file back to “.html” and you are back in action.

The software will give a warning if the projected lines of data is above a certain amount. This can be annoying, especially when I tell you that you can probably output thousands of lines of data above the limit. It will depend on what your system can hold and how patient you are to wait for the routine to finish. Find the code TheLineCap=1000; and change the value to a value that works better for you. Make it fantastically big and the warning will no longer show up or if you want to see the output every time, set the value to zero.

What if I edited the program and it does not work right now? Switch to your backup copy or get a new version from the internet and delete the bad file.

Next, there are outright annoying problems. Most operating systems will time out if the process is taking too long. Typically, the browser will notify you and give you the option to stop the program. If you regularly have this problem, I would recommend smaller data grabs.

Then, there are potentially serious problems. It is really easy to launch the software into a giant data acquisition loop and freeze up the routine. Please familiarize yourself with how to shutdown rouge programs. Hint, search the internet for “how do I stop frozen programs?” If you do not mind waiting a couple of minutes, the browser may automatically give you an opportunity to stop. Probably the easiest thing to do is to just press the “X” on the tab, close the tab, and restart the program.

Finally, JavaScript requires being enabled on your browser or else nothing will work. Exactly how it gets turned off will probably be a mystery, but it will most likely be a consequence of multiple users on the computer (or possibly non-human “users” like cats.) Once again, search the internet for “how do I enable JavaScript on my [name of browser] browser?”

Now you are experienced! What could possibly go wrong? (That is rhetorical, I really do not need to know…)

Chapter 3 — How To Use

The JavaScript code can perform two different functions which are similar, but are not the same. If you press the [Run] button you will initiate an output routine for a range of integers that produces Summary Data. Summary Data provides a complete list of the factors found and a list of any prime numbers found. You have the option to also output detailed structural family data if you want it. If you press the [Family] button you will initiate an output routine for a range of families, but there is no Summary Data. I will explain why in the functionality section.

Press the [Help] button to get the help version that the program uses.

Press the [Restart] button to reload the program with the default settings. You can simply refresh the browser window as well.

Press the [Exit] button to exit the program or just press the “X” on the tab to close the tab.

Press the [Settings] button to bring up the settings menu. There are three settings that can be turned on or off. These are Show Full Report, Show Factor by 2, and Show Factor by 3. When using the Show Full Report a detailed structural view of the families involved is provided along with the Summary Data. When the Show Full Report is turned off, only the Summary Data is provided. When the Show Factor by 2 is turned off, all factoring by 2 is ignored in the tables of Integer Factoring Families. Note that factoring by 2 is never provided in the Summary Data. When the Show Factor by 3 is turned off, all factoring by 3 is ignored in both the tables of Integer Factoring Families and the Summary Data.

Chapter 4 — Functionality

When the primary function [Run] executes, the user is required to input the low and high values for a range of integers to exam. A list of all odd integers in that range that are greater than 2 is then compiled. Since we know that the number 2 is a prime number, but is not odd, it is added to the list for completeness.

If the lowest or highest roots are divisible by 2, then we move them to the next odd number. If the lowest or highest roots are divisible by 3 and we are excluding multiples of 3, then we move them to the next odd number. The code lines for this are:

if(RLo%2==0){RLo=RLo+1;};
if(RHi%2==0){RHi=RHi-1;};
if(RLo%3==0&&!Show3x){RLo=RLo+2;};
if(RHi%3==0&&!Show3x){RHi=RHi-2;};

We know that the first root family where a number appears is at least N = An², so the lowest root is An = √[N] round up. The bottom family number is always N = An×2–1, so An = (N + 1)/2. The code lines for this are:

LowRoot=Math.ceil(Math.sqrt(RLo));
HighRoot=Math.floor((RHi+1)/2);

To be fair, I will include a side note here.

The top number for even values of (An) is N = An² — 9 for Series = 7 and N = An² — 1 for Series = 5A and N = An² — 25 for Series = 5B.The top number for odd values of (An) is N = An² for Series = 7
and N = An² — 16 for Series = 5A and N = An² — 4 for Series = 5B.

This concept could be incorporated into this routine along with the following synchronization steps.

… we simply do not get a match on every acceptable value of (An), e.g. 70/57: 1651 = 13×127 = 4900–3249: could in theory use An = 46, 52, 58, or 64; however the top of Family = 46 is 2107 and (2107 – 1651) mod 72 = 24.  The other values of (An) yield 36, 48, 60 respectively.  Finally at Family = 70 the value 0 is found and the process is synchronized.  After an initial screening, there is no need to continue looking at the incremental values of (An).  The checks will continue to repeat the sequence {12, 24, 36, 48, 60, and 0.}  At this point just increment An =  An + 36.

I might do this sometime in the future, but for now this is a relatively unrefined routine and the numbers I am using are fully functional even though they are not optimized.

After finding the LowRoot and the HighRoot, the software simply increments the An though the roots and stops at HighRoot. The family tables use a second loop for Bn from 0 to the root value. Every value of N is found using the formula: N = (An-Bn)(An+Bn). Each N is compared to the Odd Integer List. When a match is found, the N is moved to the Factors Found List. When all calculations are complete, all that is left on the Odd Integer List are Prime Numbers. Integer Factoring Families can also be built along the way if the settings allow.

When the primary function [Family] executes, the user is required to input the low and high values for a range of family roots to exam. Thus we know exactly which root families will be examined LowRoot=RLo; and HighRoot=RHi; and there is no optimization available. Again the software simply increments the An though the roots and stops at HighRoot. And again, the family tables use a second loop for Bn from 0 to the root value. Each calculation of N allows a full line to be created in the Integer Factoring Families. There is no Summary Data available because the An ranges are arbitrary and may not allow a comprehensive search for all the factors involved.

Chapter 5 — Final Notes

One last note before I have to listen to horror stories of folks transcribing information from the report window or resorting to screen shots. Place the cursor in the report window and right click. Select the [Select All] and left click. The window should become highlighted with a background color like blue. Right click in the report window again. Select the [Copy] and left click. Create a text file, i.e. “Family Factoring Table.txt” and paste into the text file and save the file. (Congratulations! You can now use this a evidence that you can follow directions.)

I hope that this essay and code provide someone some beneficial inspiration in their journey into the world of mathematics.

Appendix 1 — Standard Definitions and Equations

^…  — Raise to the Power of
[…] — Square Root Function
An — Factor of Base Root Value: An ≥ √[N]
N’
— Integer Prime Number: N’= N’×1 ≠ N
N
— Composite Integer Factorization: N = Xn×Yn ≠ N’
N
— Fermat’s Factorization: N = An² − Bn²
= (An − Bn)(An + Bn)
N
— Series Factorization: N = Si + 6 Sn
= (Sa+ 6Sx)(Sb+ 6Sy)
Si
— Series Identifier for Composite N: Si = 5 or 7
Sa
— Series Identifier for Xn: Sa = 5 or 7
Sb
— Series Identifier for Yn: Sb = 5 or 7
Xn
— Smaller Integer Factor of N: Xn = An − Bn where 1<Xn≤Yn
Yn
— Larger Integer Factor of N: Yn = An + Bn where Yn≥Xn>1

Appendix 2 — Source Code Listing

<html>
<head>
<style type= "text/css">
body{background-color:#22B14C;}
</style>
<script>
var ProgramName="Families of Factors Output Routine";
var ProgramVersion="3.00";
var ProgramCopyRight="(c) Copyright 2021, JB Johnson";
//-- Program Control Variables
var MenuSetUpTop=3;
var OnEnd=false;
var OnError=false;
var ShowAll=true;
var Show2x=false;
var Show3x=true;
var TheSetUpIsAt=1; //-- Setup Menu Pointer
var TheTrialCap=1000000000;
//-- Number of lines of output allowed without a warning
var TheLineCap=1000;
//-- Allows user to step through code implementation
var TestOn=false;
//-- Input Variables
var InputDefault="None";
var InputMin=0;
var InputMax=0;
var InputQuery="?"; //-- Changed as needed
var InputValue=0;
//-- Retainer Variables
var HighRoot=0;
var LowRoot=0;
var OddText=":";
var RHi=0;
var RLo=0;
var TextError="";
var TextHelp="";
var TextInput="";
var TextReady="Ready...";
var TextSetUp="";
var TheFactors="";
var ThePrimes="";
var TheReport=ProgramName+" "+ProgramVersion+"\n";
var TotalLines=0;
//-- Constant Variables
var TextDivider=
"......................................................";
var TextForMath="Math definitions are based on Fermat Factoring"
+ " where N=An^2-Bn^2=(An-Bn)(An+Bn)=XnxYn. "
var TextZero="0/0: 0=0x0=0-0: Factor by 3: Factor by 2";
//-- General Purpose Variables
var I=0;var TextAdd="";
var AI=0;var Y=0;var SPlusY=0;var SLessY=0;var N=0;var Z=1;
var R=0;var Si=0;var Yi=0;
var Ni=0;var Ii=1;var QIi="1";
var Nia=0;var Iia=1;var QIia="1";
var Nia=0;var Iia=1;var QIia="1";
var FoundAt=":";var TheDrop=0; var TheTop=0;
window.onload=function()
{
document.getElementById("ProgramStatusLine").value=ProgramName
+" "+ProgramVersion+" -- "+ProgramCopyRight;
ShowHelp();
if(confirm("Start Output Routine Now")){MainLoop();};
};
function ClearAll()
{
OnEnd=false;
OnError=false;
TextError="There are no current errors...";
};
function GetInput()
{
var ThisMaxText=InputMax.toString();
TextInput=TextReady;
InputQuery=InputQuery
+" ("+InputMin.toString()+"-"+ThisMaxText+"):";
while(TextInput==TextReady)
{
TextInput=prompt(InputQuery,InputDefault);
if(TextInput==null||TextInput==""){OnEnd=true;return;};
if(TextInput!=TextReady)
{
if(isNaN(TextInput))
{
TextError=TextInput+" is not a number.";
ShowError();return;
};
InputValue=Math.floor(Number(TextInput));
if(InputValue>InputMax)
{
TextError=InputValue.toString()
+" is greater then maximum input of "
+InputMax.toString()+".";
ShowError();return;
};
if(InputValue<InputMin)
{
TextError=InputValue.toString()
+" is less than minimum input of "+InputMin.toString()+".";
ShowError();return;
};
};
};
};
function MainLoop()
{
OddText=":";
ClearAll(); InputDefault="0";
InputMin=0;
InputMax=TheTrialCap;
InputQuery="Input Lower Range Limit";
GetInput();if(OnError||OnEnd){return;};
RLo=InputValue;
document.getElementById("ReportDisplay").value="Searching... please wait."; InputDefault=RLo.toString();
InputMin=RLo;
InputMax=TheTrialCap;
InputQuery="Input Upper Range Limit";
GetInput();if(OnError||OnEnd){ShowHelp();return;};
RHi=InputValue;
TheReport=ProgramName+" "+ProgramVersion+"\n"
+ProgramCopyRight+"\n"
+"Searching for all integers between "+RLo.toString()
+" and "+RHi.toString()+"...\n\n"
+TextForMath
+"\n";
//-- Create a List of All Odd Numbers in the Range
if(RLo<=2){OddText=OddText+"2:"}; //-- Don't forget the number 2
I=0;
for(I=RLo;I<=RHi;I=I+1)
{
if(I<3) {continue;}; //-- Exclude one even if it is odd
if(I%2==1){OddText=OddText+I.toString()+":";};
};
if(RLo%2==0){RLo=RLo+1;};
if(RHi%2==0){RHi=RHi-1;};
if(RLo%3==0&&!Show3x){RLo=RLo+2;};
if(RHi%3==0&&!Show3x){RHi=RHi-2;};
LowRoot=Math.ceil(Math.sqrt(RLo));
HighRoot=Math.floor((RHi+1)/2);
TheReport=TheReport+"Roots Used for An: "+LowRoot
+" to "+HighRoot+"...\n\n"
//-- Warn user about huge data output
if(ShowAll)
{
TotalLines=(HighRoot-LowRoot)*(HighRoot+LowRoot)/2;
if(!Show2x){TotalLines=TotalLines/2;};
if(!Show3x){TotalLines=TotalLines/2;};
TotalLines=Math.floor(TotalLines);
if(TotalLines>TheLineCap)
{if(!confirm("Roots Used for An: "+LowRoot+" to "+HighRoot
+"... \n"
+"This will create approximately "+TotalLines.toString()
+" lines of output. \n"
+"Press Ok to Continue.")){return;};};
};
if(ShowAll)
{
TheReport=TheReport
+"An/Bn: N=XnxYn=An^2-Bn^2: Factor Series: Drop from top\n"
+TextDivider;
if(RLo==0){TheReport=TheReport+"\n"+TextZero;};
}
else
{
TheReport=TheReport+"Searching for Factors...\n\n"
};
AI=0;Y=0;SPlusY=0;SLessY=0;N=0;Z=1;
R=0;Si=0;Yi=0;
Ni=0;Ii=1;QIi="1";
Nia=0;Iia=1;QIia="1";
Nia=0;Iia=1;QIia="1";
FoundAt=":";TheDrop=0;TheTop=0;
//-- Cycle through all Root Families
for(I=LowRoot;I<=HighRoot;I=I+1)
{
if(I%2==0){Y=1}else{Y=0}; if(Show2x){Y=0;};
Z=1;
if(I%3==0)
{
if(I%2==1)
{TheTop=(I-2)*(I+2);}
else
{TheTop=(I-1)*(I+1);};
}
else
{
if(I%2==1)
{TheTop=(I)*(I);}
else
{TheTop=(I-3)*(I+3);};
};
//-- Generate Line by Line Details
TableDetails();
if(ShowAll){if(!Show2x&&!Show3x&&Y==2)
{}else{TheReport=TheReport+"\n"};};
if(TestOn)
{
document.getElementById("ReportDisplay").value=TheReport;
if(confirm("Quit?")){return};
};
};
if(ShowAll){TheReport=TheReport+"\n";};//-- Sort Factors and Primes
ThePrimes="";TheFactors="";var A=OddText.split(":");
for(AI=1;AI<A.length-1;AI=AI+1)
{
if(!Show3x)
{
var B=A[AI].split("=");
var C=B[0].split("x");
if(Number(C[0])%3==0||Number(C[1])%3==0){continue;};
};
if(A[AI].indexOf("=")>=0)
{TheFactors=TheFactors+A[AI]+",";}
else
{ThePrimes=ThePrimes+A[AI]+",";};
};
TheReport=TheReport+TextDivider+"\n\n";
if(TheFactors==""){TheFactors="None";};TheReport=TheReport+"Factors Found: "+TheFactors+"\n\n";
if(ThePrimes==""){ThePrimes="None";};TheReport=TheReport+"Primes Found: "+ThePrimes+"\n\n";
document.getElementById("ReportDisplay").value=TheReport;
};
function TableDetails()
{
while(I-Y>=0&&Y>=0)
{
SLessY=I-Y;SPlusY=I+Y;N=SLessY*SPlusY;TheDrop=TheTop-N;
if(I%3==0&&I%2==1&&(Y-1)%3==0){TheDrop=(I-4)*(I+4)-N;};
if(I%3==0&&I%2==0&&(Y-2)%3==0){TheDrop=(I-5)*(I+5)-N;};
Si=Math.sqrt(N);if(Si>Math.floor(Si)){Si=Math.floor(Si+1);};
R=Si*Si-N;
Yi=Math.sqrt(R);if(Yi>Math.floor(Yi)){Yi=Math.floor(Yi+1);};
if(Si%2==Yi%2){Yi=Yi+1;};
Ni=Math.floor((N+1)/6);Ii=1;QIi="+1";
if(6*Ni-N==1){Ii=-1;QIi="-1"};
Nia=Math.floor((SLessY+1)/6);Iia=1;QIia="+1";
if(6*Nia-SLessY==1){Iia=-1;QIia="-1"};
Nib=Math.floor((SPlusY+1)/6);Iib=1;QIib="+1";
if(6*Nib-SPlusY==1){Iib=-1;QIib="-1"};
if(Show3x||N%3>0)
{
if(ShowAll)
{TheReport=TheReport+"\n"+I.toString()+"/"+Y.toString();};
if(ShowAll){TheReport=TheReport+": "+N+"="+SLessY+"x"+SPlusY;};
if(ShowAll){TheReport=TheReport+"="+(I*I).toString()
+"-"+(Y*Y).toString();};
if(ShowAll&&FoundAt.indexOf(":"+N.toString()+":")>=0)
{TheReport=TheReport+"*";};
if(ShowAll&&N%3>0&&N%2>0)
{
TextAdd=(Ni-1).toString();
if(Ni==0){TextAdd="("+TextAdd+")";};
if(QIi==-1)
{TheReport=TheReport+": 5+6x"+TextAdd;}
else
{TheReport=TheReport+": 7+6x"+TextAdd;};
};
if(ShowAll&&N%3>0&&N%2>0)
{
TextAdd=(Nia-1).toString();
if(Nia==0){TextAdd="("+TextAdd+")";};
if(QIia==-1)
{TheReport=TheReport+"=(5+6x"+TextAdd+")";}
else
{TheReport=TheReport+"=(7+6x"+TextAdd+")";};
};
if(ShowAll&&N%3>0&&N%2>0)
{
TextAdd=(Nib-1).toString();
if(Nib==0){TextAdd="("+TextAdd+")";};
if(QIib==-1)
{TheReport=TheReport+"(5+6x"+TextAdd+")";}
else
{TheReport=TheReport+"(7+6x"+TextAdd+")";};
};
if(ShowAll&&N%3>0&&N%2>0)
{TheReport=TheReport+": Drop="+TheDrop.toString();};
if(ShowAll&&N%3==0)
{TheReport=TheReport+": "+"Factor by 3";};
};
if(ShowAll&&Show2x&&N%2==0)
{if(ShowAll){TheReport=TheReport+": "+"Factor by 2";};};
if(OddText.indexOf(":"+N.toString()+":")>=0)
{
var A=OddText.split(":");
OddText=":";
for(AI=1;AI<A.length-1;AI=AI+1)
{
if(A[AI]==N&&SLessY>1)
{OddText=OddText+N+"="+SLessY+"x"+SPlusY+":";}
else
{OddText=OddText+A[AI]+":";};
};
};
if (Show2x){Y=Y+Z;}else{Y=Y+Z*2;};
};
};
function FamilyRun()
{
ShowAll=true;
OddText=":";
ClearAll(); InputDefault="0";
InputMin=0;
InputMax=TheTrialCap;
InputQuery="Input Lower Family Number";
GetInput();if(OnError||OnEnd){return;};
RLo=InputValue;
document.getElementById("ReportDisplay").value=
"Searching... please wait.";
InputDefault=RLo.toString();
InputMin=RLo;
InputMax=TheTrialCap;
InputQuery="Input Upper Family Limit";
GetInput();if(OnError||OnEnd){ShowHelp();return;};
RHi=InputValue;
TheReport=ProgramName+" "+ProgramVersion+"\n"
+ProgramCopyRight+"\n"
+TextForMath
+"\n";
LowRoot=RLo;
HighRoot=RHi;
TheReport=TheReport+"Roots Used for An: "+LowRoot
+" to "+HighRoot+"...\n\n"
//-- Warn user about huge data output
if(ShowAll)
{
TotalLines=(HighRoot-LowRoot)*(HighRoot+LowRoot)/2;
if(!Show2x){TotalLines=TotalLines/2;};
if(!Show3x){TotalLines=TotalLines/2;};
TotalLines=Math.floor(TotalLines);
if(TotalLines>1000)
{if(!confirm("Roots Used for An: "+LowRoot+" to "
+HighRoot+"... \n"
+"This will create approximately "+TotalLines.toString()
+" lines of output. \n"
+"Press Ok to Continue.")){return;};};
};
if(ShowAll)
{
TheReport=TheReport
+"An/Bn: N=XnxYn=An^2-Bn^2: Factor Series: Drop from top\n"
+TextDivider;
if(RLo==0){TheReport=TheReport+"\n"+TextZero;};
}
else
{
TheReport=TheReport+"Searching for Factors...\n\n"
};
if(ShowAll)
{
TheReport=TheReport
+"An/Bn: N=XnxYn=An^2-Bn^2: Factor Series: Drop from top\n"
+TextDivider;
if(RLo==0){TheReport=TheReport+"\n"+TextZero+"\n";};
}
else
{
TheReport=TheReport+"Searching for Factors...\n\n"
};
AI=0;Y=0;SPlusY=0;SLessY=0;N=0;Z=1;
R=0;Si=0;Yi=0;
Ni=0;Ii=1;QIi="1";
Nia=0;Iia=1;QIia="1";
Nia=0;Iia=1;QIia="1";
FoundAt=":";TheDrop=0;TheTop=0;
if(ShowAll)
{
TheReport=TheReport
+"An/Bn: N=XnxYn=An^2-Bn^2: Factor Series: Drop from top\n"
+TextDivider;
if(RLo==0){TheReport=TheReport+"\n"+TextZero+"\n";};
}
else
{
TheReport=TheReport+"Searching for Factors...\n\n"
};
AI=0;Y=0;SPlusY=0;SLessY=0;N=0;Z=1;
R=0;Si=0;Yi=0;
Ni=0;Ii=1;QIi="1";
Nia=0;Iia=1;QIia="1";
Nia=0;Iia=1;QIia="1";
FoundAt=":";TheDrop=0;TheTop=0;
//-- Cycle through all Root Families
for(I=LowRoot;I<=HighRoot;I=I+1)
{
if(I%2==0){Y=1}else{Y=0}; if(Show2x){Y=0;};
Z=1;
if(I%3==0)
{
if(I%2==1)
{TheTop=(I-2)*(I+2);}
else
{TheTop=(I-1)*(I+1);};
}
else
{
if(I%2==1)
{TheTop=(I)*(I);}
else
{TheTop=(I-3)*(I+3);};
};
if(I%3==0)
{
if(I%2==1)
{TheTop=(I-2)*(I+2);}
else
{TheTop=(I-1)*(I+1);};
}
else
{
if(I%2==1)
{TheTop=(I)*(I);}
else
{TheTop=(I-3)*(I+3);};
};
//-- Generate Line by Line Details
TableDetails();
if(ShowAll)
{if(!Show2x&&!Show3x&&Y==2){}else{TheReport=TheReport+"\n"};};
};
if(ShowAll){TheReport=TheReport+"\n";}; TheReport=TheReport+TextDivider+"\n\n";
document.getElementById("ReportDisplay").value=TheReport;
};
function ProgramExit()
{
var ThisIsOk=true;
ThisIsOk=confirm("Ready to Exit Program"
+"\n"+"Do you want to continue?");
if(ThisIsOk)
{
window.opener=window.open('','_self','');
window.opener.close();
if(TextBrowser=="Netscape")
{document.location.href="about:blank";};
};
};
function ProgramRestart()
{
var ThisIsOk=true;
ThisIsOk=confirm("Ready to Reload the Program"
+ "\n" + "Do you want to continue?");
if(ThisIsOk){window.location.reload(true);};
};
function SettingsEdit()
{
var ThisIsOk=true;
ClearAll();
ShowSettings();
document.getElementById("ReportDisplay").value=TextSetUp+"\n\n";
InputDefault=TheSetUpIsAt.toString();
InputMin=1;
InputMax=MenuSetUpTop;
InputQuery="Input Setting to Change";
GetInput();if(OnError||OnEnd){return;};
TheSetUpIsAt=InputValue;
if(TheSetUpIsAt==1)
{
if(ShowAll)
{ShowAll=false;}
else
{ShowAll=true;}
};
if(TheSetUpIsAt==2)
{
if(Show2x)
{Show2x=false;}
else
{Show2x=true;}
};
if(TheSetUpIsAt==3)
{
if(Show3x)
{Show3x=false;}
else
{Show3x=true;}
};
ShowSettings();
document.getElementById("ReportDisplay").value=TextSetUp+"\n\n";
};
function SetUpFix()
{
};
function ShowError()
{
OnError=true;
TextError="Error: "+TextError;
alert(TextError);
ShowHelp();
};
function ShowHelp()
{
TextHelp="";
if(TextError!=""){TextHelp=TextHelp+TextError+"\n\n";};
TextHelp=TextHelp
+"This routine will find the roots required to evaluate integers between the low limit and the upper limit. "
+"Each root family will be explored to find all factors and prime numbers in the given range. "
+TextForMath
+"Data will be output according to the program settings. "
+"See [SETTINGS] for more information. "
+"Summary Data provides a complete list of the factors found and a list of any prime numbers found. "
+"If Report Mode is turned on, detailed structural family data is also output. "
+"This data includes the primary root and the secondary root with the composite integer and factors. "
+"This data also includes the drop difference of the composite integer from the top of the family. "
+"\n\n";
TextHelp=TextHelp
+"Be aware of the fact that the size of the data output is exponential. "
+"Searching the range 0 to 100 gives 4 pages of data in Full Report Mode. "
+"Searching the range 1000 to 1100 gives 254 pages of data. "
+"Searching with Full Report Mode turned off is significantly faster and produces far less data. "
+"Please note that when Report Mode is turned off there is only Summary Data. "
+"See [SETTINGS] for more information. "
+"\n\n";
TextHelp=TextHelp
+"Use [RUN] to initiate an output routine for a range of integers. "
+"\n\n";
TextHelp=TextHelp
+"Use [FAMILY] to initiate an output routine for a range of families. "
+"Please note that Summary Data of factors and prime numbers will NOT be provided. "
+"\n\n";
TextHelp=TextHelp
+"Use [SETTINGS] to change the program settings. "
+"When using the Full Report a detailed structural view is provided. "
+"When not using the Full Report only the summary is provided. "
+"When not using the 2x Factor all factoring by 2 is ignored. "
+"When not using the 3x Factor all factoring by 3 is ignored. "
+"\n\n";
TextHelp=TextHelp
+"Use [RESTART] to reload the program with the default settings. "
+"\n\n";
TextHelp=TextHelp
+"Use [EXIT] to close the program completely. "
+"\n\n";
document.getElementById("ReportDisplay").value=TextHelp+"\n\n";
};
function ShowSettings()
{
SetUpFix();
TextSetUp="Current Settings:\n\n";
TextSetUp = TextSetUp
+ "1 = Show Full Report: "+ShowAll+"\n"
+ "2 = Show Factor by 2: "+Show2x+"\n"
+ "3 = Show Factor by 3: "+Show3x+"\n"
+ "\n\n";
};
function ShowSettings()
{
SetUpFix();
TextSetUp="Current Settings:\n\n";
TextSetUp = TextSetUp
+ "1 = Show Full Report: "+ShowAll+"\n"
+ "2 = Show Factor by 2: "+Show2x+"\n"
+ "3 = Show Factor by 3: "+Show3x+"\n"
+ "\n\n";
}
</script>
</head>
<body><Input Text
ID="ProgramStatusLine"
Size=80
Value="No Status Data Available"
ReadOnly
>
<form name="TheForm">
<input type="button" value="RUN" onclick="MainLoop()">
<input type="button" value="SETTINGS" onclick="SettingsEdit()">
<input type="button" value="FAMILY" onclick="FamilyRun()">
<input type="button" value="HELP" onclick="ShowHelp()">
<input type="button" value="RESTART" onclick="ProgramRestart()">
<input type="button" value="EXIT" onclick="ProgramExit()">
</form>
<TEXTAREA NAME="TheReport" ID="ReportDisplay" ROWS="30" COLS="120">
No Data...
</TEXTAREA>
<noscript>
<B><Table
ID="No_JavaScript_Warning"
Style="Background-Color:Red;Width:300px;Font-size:20px;
Color:White;Text-Align:Center;Position:Absolute;
Top:150px;Left:50px;Z-Index:999;Visibility:Visible;"
><TD>JavaScript is not active!</TD>
</Table></B>
</noscript>
</body>
</html>

--

--

JB Johnson

I am a science and technology junky and this is my place where I can share my ideas.