Start up time program auto build long prime list from 2 to 5000011.
Build primeA6n[] list and build primeGap[] . Wait about 20 sec.
Pay6 Prime number calculator ; update 2018-12-12
2018-11-03 first upload pay6get2.htm ; what can I do?
Other prime web pages usage p[1]=2, p[2]=3, p[3]=5, p[4]=7 ... p[0]=2, p[1]=3, p[2]=5, p[3]=7 ...
because prime_e2.htm follow javascript index start from 0.
2016-08-29-07-29 record
prime_e2.htm index
program , Arndt , jsprime2.htm DocA , first upload 2016-08-06
XYGraph v2.3 - web page graph   ☜☞   donate   get code
Prime Counting Function Graph tute0058.htm#primeCountDraw click [A1]
Prime Counting >> Square Counting ; ∑(1/Sq.)=π*π/6 , ∑(1/prime)→∞
see proof at to docA454
The Cauchy-Schwarz Master Class   J. Michael Steele   ★★★★★
Please use MSIE browser to read this file.
Program environment Acer computer Aspire 5750Z-4830.
MSIE 9.0 Version:9.0.8112.16421
This file is personal home work. No one
proofread. Cannot promise correctness.
If you suspect any view point wrong,
please ask a math expert near by.
Freeman 2009-06-19-10-46

Liu,Hsinhan is not a professional programmer and
not a mathematics major graduate. This page may
contain error or low efficiency code.

Liu,Hsinhan 劉鑫漢 2016-08-12-19-18

<a name=index>
Prime number calculator prime_e2.htm index
All document are in help click button or output top/bottom.

✚✚ Prime Gap Rules , Six n harmony rule = avoid_Prime3_cut rule
   Prime5 cut rule , include 7,11,13,17,19
✚✚ Consecutive Prime Gaps 20,14 allowed? or not allowed?
   input box and click button [Allowed?] , [prime5cut()]

✚✚ Bulk Harmony Rule checker allow gap sequence cross several lines.
    yellow input, BoxPGR output, [Allowed?] read one line gap sequence.
✚✚ Click RUN14 four buttons first, click RUN5 Build html table
   for prime gap mod(6)=0,2,4 and consecutive n count.
✚✚ [Build prime list] prime definition read user prime table
   define fake prime table see why squares cannot replace prime?

✚✚ output prime table, gap sequence, gap up/down sequence
   6*n+1 prime or 6*n-1 prime

✚✚ integer's prime multiplication factorization
   change 2200 to 2^3 * 5^2 * 11^1 or to 2*2*2*5*5*11
✚✚ set gap number, example gap=8, first pair is 89, 97
   list squeezed composite 90,91,92,93,94,95,96

✚✚ prime counting function π(n) or pcf(n), standard mathematics term
   prime focus function pff('1000,2')=997,991 ; pff() used in prime_e2.htm
✚✚ illPrimeGap() read one prime between 5 and 19, output prime gap sequence
   which MUST be void by input prime. Create sample for testing [prime5cut()]
✚✚ Test function inIdUL() change input box string data to numbers
   Test function toComma() change from " 2 ; -4 ;; 2 ; " to "2,-4,2"
✚✚ Test function boundPrime(n) use fast code to search prime p just > n
   boundPrime(n) long jump to proper range and search prime, save time.
✚✚ [sumToBox] Goldbach conjecture 20=17+3 , 20=13+7 incremental summary
   work. Box75 has over all summary which is Box74 output last line result
✚✚ [mulToBox] do Integer prime multiplication factorization, 20=2^2 * 5^1
   prime incremental count (output Box74) and prime total count (output Box75).

✚✚ test function stringList_to_arrayList() Click [exW] fill example string to
   Box76, then click [str2arr] button, change string data to array data. Box77 output.
✚✚ show prime list in Box78
   show gap list in Box78
✚✚ [pr^HiPow] number or prime to higher power, 23^3 , fall in what kind
   neighborhood? any specialty? click [pr^HiPow] and think.
✚✚ sin(), cos(), exp() regular calculator. real number only, no complex. Auto change
   from 102=89+13 to 102-89-13 and evaluate to 0. Confirm 102=89+13 is OK.

✚✚ Six n Prime Table builder
   Click button [BPrCPr] create Six n Prime Table
✚✚ Pay6 prime expression , pay6get2.htm focus

<a name="program0">
Prime number calculator

Prime Gap Rules six n harmony rule visualization
Six n harmony rule = avoid_Prime3_cut rule.
6*n-1 prime cross n line, 6*n+1 prime cross n line in turn.
Prime has 6*n-1 and 6*n+1 two groups. Consecutive prime difference is prime gap.
Let p(k+1)-p(k)=g(k) Except prime 2 and 3, prime gap is always even number.
primeGap%6 has 0, 2, 4 three possible values.
primeGap%6=0 say p(k+1) and p(k) both be 6*n-1 or both be 6*n+1.
primeGap%6=2 say p(k) is 6*n-1 and p(k+1) is 6*n+1 . Example 17+2=19
17=6*3-1 , 19=6*3+1 . Gap 2,8,14,20 etc. must be from 6*n-1 to 6*n+1
primeGap%6=4 say p(k) is 6*n+1 and p(k+1) is 6*m-1 . Example 19+4=23
19=6*3+1 , 23=6*4-1 . Gap 4,10,16,22 etc. must be from 6*n+1 to 6*m-1
primeGap%6=2 gap follow primeGap%6=2 is forbidden.
primeGap%6=4 gap follow primeGap%6=4 is forbidden.
primeGap%6=2 gap follow primeGap%6=4 is allowed.
primeGap%6=4 gap follow primeGap%6=2 is allowed.
Gap 2,2 is not allowed, ONLY initial prime 3,5,7 has gap sequence 2,2 .
Gap 20,12,14 is not allowed, 12%6=0 is transparent, 20%6=2,14%6=2 forbidden.
Prime5 cut rule , include 7,11,13,17,19
Allowed gap sequence may be cut off by composite contain 5,7 etc.
Gap sequence 6,6,6,6 void by multiple of five, 6,6,6,6 never show up.
Gap 6,4,2,4,2,4 void by multiple of seven. 6,4,2,4,2,4 never show up.
Input your prime sequence in yellow box below.
Click [Allowed?] to test Six n harmony rule.
Click [prime5cut()] to test Prime5 cut rule.
Liu,Hsinhan 劉鑫漢 2016-08-16-23-25
p(k) is k-th prime. k in p(k) and n in 6*n-1 are independent. a508170626 "p p+2 p+6 p+8 : A007530" is 2,4,2 in prime_e2.htm a508241428
Six n harmony rule is in fact avoid_Prime3_cut rule. 2016-08-24-16-02

<a name="bxPGR"> 2016-08-17-10-16 in prime_e2.htm use BoxPGR
Consecutive Prime Gaps 10,10 allowed? or not allowed? Please input and test.
Next yellow box INPUT Prime Consecutive Gaps , click Example buttons.
Example ,,,, ; ,,,, ; [,,,] six n harmony rule
yellow input, BoxPGR output        
Above six n harmony rule exam, below prime 5,7,11 cut exam are independent.
prime 5,7,11 cut RUN 1 yellow box, blue box input, BoxPGR output
exam prime from prime 5 to prime expect a small prime for [prime5cut()]

yellowbox example , , , , ;  prime 5 to prime  
RUN 2 yellow and pink box input, BoxPGR output
output long or short ? output short few 1
PGR=Prime Gap Rules ; QEboxcPGR.value='' ;

modsix024, short024, group024, ascend024 main goal is direction study. Prime has 6*n-1
and 6*n+1 two groups. Gap%6=2 must be from 6*n-1 to 6*n+1. Gap%6=4 must be
from 6*n+1 to 6*n-1. Gap%6=0 must be from 6*n-1 to 6*n-1 or from 6*n+1 to 6*n+1.
primeArr[] is 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71 ...
primeGap[] is 1,2,2,4,2,4,2,4,6,2,6,4,2,4,6,6,2,6,4,2,6,4,6,8,4,2,4,2,4 ...
modsix024[]=gap%6 . Mod(6) remainder has 0,2,4 three values. 0,2,4 are direction.
short024 change from modsix024[]=2,4,2,4,2,4,0,2,0,4,2,4,0,0,2,0,4,2,0,4, ...
to short024[]=26,01,21,01,43,02,21,01,42,01,41,01,28,01,23,02,41,02, ...
group024 change short024 to 0 group, 2 group, 4 group. (0,2,4 are direction)
ascend024 arrange 0 group, 2 group, 4 group in ascending order.
list024 read user input and list direction 0,2,4 to output box. Help user study.
2016-09-19-18-41 start, 2016-09-19-19-20 stop

six n harmony rule visualization. Ignore initial prime 2,3; ignore initial prime gap 1,2. All
gap%6=0 are transparent, gap sequence must be 2,4 in turn. Click [modsix024] see BoxPGA.
gap sequence direction data, output only 0,2,4 RUN 3
BoxPGA   Yellow is one series calculation, green is another

QEboxcPGA.value='' ; Long prime gap sequence example or input your gap sequence
BoxPGA input RUN 4 BoxPGB output

<a name="bxPGB"> click [modsix024 ], build modsix024[] array first.
Compact [modsix024] data, input from modsix024[] RUN 5 output to BoxPGB
BoxPGB   short 26,01; drop pID ;


<a name="bxPGC"> ; click [short024 ], build short024[] array first.
Separate [short024] data to 0,2,4 groups, RUN 6 id=QEspangroup024
BoxPGC   ;

Click RUN14 four buttons, then click RUN5 [list024] to build Primegap Modsix Short Table
QEspanPrimeCount.innerHTML='' ;
Click one by one RUN14 , , ,
QEspanascend024.innerHTML='' ;
list024 example RUN5 output to BoxPGD ; index
Prime gap modsix begin/end

BoxPGD   ; ask list024


Build prime table
Box01:prime table; Box02:input integer; Box03:output factorized integer;
Box04:input integer factorization list, click [Prime counting] Box05:output summary
Box01   ; paste user prime list to Box01 or prime list

Build⇒ up to ,
in Box02 Show primeID , prime , gap , gap%6 , gapUp/Down , 6*n±1
Box02 data column ↕ to ↔ row change , RUN 7
upper_lower bounds , default number 1 to 5001
Box02   ;

QAboxc02.value='' ; already merge to [Build prime list]

integer's prime factorization. 2200=2^3 * 5^2 * 11^1
[factorize integer pow] and [factorize integer mul] read input from Box03, output to Box04.
Work is integer's prime factorization. For example, [factorize integer pow] change from
composite 2200 to prime multiplication 2^3 * 5^2 * 11^1 . Button [factorize integer mul]
output to 2200=2*2*2*5*5*11 . Button [integer list] help you build continuous integers.
Box03   ; Integer ends output to Box03

example: , , , RUN 8 ,
Box04 ; [factorize integer] Box03 input, Box04 output ; index

Box04 in Box05 out
Box05   QAboxc05.value=''


Assume Prime Upper/Lower bound has [2,2000], assume One prime gap has [8]
Click [squeezed number] output [2,2000] all prime gap=8 in-gap composite numbers.
Default input has first gap output 90,91,92,93,94,95,96 seven composite. Purpose
is to study squeezed composite their prime multiplication factorization has what
special point relate to 8 (gap size). a508181641
U/L bound box use comma [2,2000] mean 2 and 2000 are both integers.
U/L bound box use column [2:2000] mean 2 and 2000 are both primeID.
Initial primes are 2,3,5,7,11,13,17,19 ... ; primeID=pID=0,1,2,3,4,5,6,7 ...
This page use pID=0 for first prime 2. Some other page use pID=1 for prime 2.
prime pair squeezed integers, middle integer
Prime Upper/Lower bound06 One prime gap
Box06 ; yellow box input output to box06

Second [squeezed number] , near [squeezed middle] ;
[squeezed middle] input is box06, output to box07. If assign [8] to One prime gap box.
Click [squeezed number], box06 has squeezed composite numbers 90,91,92,93,94,95,96 .
MUST be odd count squeezed numbers. Click [squeezed middle] output to box07 93, 363,
393, 405, 453, 483, 495, ... They are all squeezed middle number. Program copy first
squeezed gap ALL numbers for reference. Start from second gap, copy only middle ONE
number. Purpose find whether squeezed middle has special point.
Click in output choice green box, allow you change middle to other choice.

Six n Prime Table builder

Click button [BPrCPr] create Six n Prime Table. In [6*n±1, n Bgn/End] box specify n value
(not integer value) Click [BPrCPr], program output html table to Box20. If n range not
exceed 1000. Program display Six n Prime Table below Box20. If result satisfied, user can
copy Box20 html table and paste to other page.
[BPrCPr] mean BPrime,CPrime . Follow "List n value with A/B/C/D" Liu,Hsinhan consider
6*n+1 type prime be BPrime. consider 6*n-1 type prime be CPrime.
2016-08-25-11-52 document here ; index
I have two change to n value and save to green box below
I have two ; Show composite long/short 7^2 * 11^1
6*n±1, n Bgn/End , RUN c output to Box20
Box20 Six n Prime Table input green box above, output to Box20

QDboxc20.value='' ;
Show composite long/short? Long output 7^2 * 11^1 it has more information
and bigger html table size. Short output 7^2 only and drop "* 11^1" it has
dominate factor 7^2 and thinner html table size. 2016-09-14-14-27 record

<a name=pay6bgn>
Pay6 prime expression a710271210
What is "pay6"? pay6="pace six", merge two 's' to "pay6"
Two consecutive primes pr1 and pr2>pr1, take the difference
gap1=pr2-pr1. Example pr1=17 < 19=pr2, gap17=19-17=2.
rearrange get pr1+gap1=pr2. Example pr1+gap1=89+8=97.
Page pay6get2.htm focus on prime gaps. Prime list
2 ; 3 ; 5 ; 7 ; 11 ; 13 ; 17 ; 19 ; 23 ; 29 ; 31 ; 37 ; 41 ; 43 ; 47 ...
can be written as gap list 2 ; 3 ; 5 ; RED gaps follow 2 ; 3 ; 5
2 ; 3 ; 5 ; 2 , 4 , 2 , 4 , 2 , 4 , 6 , 2 , 6 , 4 , 2 , 4 ...
Recover prime 7 from prime5 and gap 2, that is 7=5+2.
Following primes can be recovered one by one same way.
Initial prime 2,3,5 are special case. 2 to 3 gap=1.
3,5,7 gap 2,2 is special too. gap 2,2 never occur after 3,5,7.
Since two consecutive prime gaps gap1,gap2 the relation
gap1%6=gap2%6 is not allowed. They must be cut by prime3.
prime section 173;179;181;191;193;197;199;211;223;...
has gap section 6 ; 2 ; 10 ; 2 ; 4 ; 2 ; 12 ; 12 ...
write each gap as p*s+q where p is an integer >=0
's'='six'=6, a constant. In code '*s' is dropped to save
memory. q is either 0, or 2=T=two or 4=F=four .
p is quotient of gap/6 , q is remainder of gap/6 .
remainder=0 not record, remainder=2 mark 'T' (two)
remainder=4 mark 'F' (four). If gap=2, gap=4, then
quotient p=0, this zero quotient not record. There
is no confusion if not record zero, also save space.
pay6 record gap=2 as 'T'; record gap=4 as 'F';
record gap=6 as 1 (p=1*6=6); record gap=8 as '1T';
record gap=22 as '3F'; and gap=24 as 4 (p=4*6=24);
record gap p*6+0 as integer, otherwise as string.

gap 6=179-173 has p=1 and q=0. 1*6+0=6
gap 2=181-179 has p=0 and q=2. 0*6+2=2
gap10=191-181 has p=1 and q=4. 1*6+4=10
gap12=223-211 has p=2 and q=0. 2*6+0=12 ...
gap32=4568371-4568339, p=5,q=2; 5*6+2=32
gap46=4882907-4882861, p=7,q=4; 7*6+4=46 ...
gap 2 , 4 , 2 , 4 , 2 , 4 , 6 , 2 , 6 , 4 , 2 , 4 ...
or gap 6 ; 2 ; 10 ; 2 ; 4 ; 2 ; 12 ; 12 ...
write as gap=p*s+q and record (p,q) to save space.
prime 173; 179; 181; 191; 193; 197; 199; 211; 223;...
change to 173; 6 , 2 , 10 , 2 , 4 , 2 , 12 , 12 ...
change to 173 ; 1 , 'T' , '1F ' , 'T' , 'F' , 'T' , 2 , 2 ...
Above line is pay6 string. Pay6 string first element
must be prime number, which generate all remaining primes;
Pay6 string recording method save memory space.
Pay6 string show p sequence and show q sequence.
Liu,Hsinhan hope find invariant in p,q sequence.
Hope from p,q sequence find next gap size.
2018-10-27-16-10     Input number not allow contain factors 2,3,5,7. If uncheck 3, and change input 29
to 27, output 2,o,t,t,f,t,f,t,f,f,f,1,f,t,f,1,1 ... where "f,f,f" is an error. Prime gap law
disallow "f,f,f". Checkbox let user experiment violation of 2,3,5,7. From 11 stop check.
Check composite factor prime2 , 3 , 5 , 7 ; all off , all on
User is responsible to supply correct prime array
Example prime array , click ==> , output to Box21
Box21   ; Box21 data column ↕ to ↔ row change ,

Box22 ; RUN f Box21 in Box22 out , ;

Box23 ; RUN g Box22 in Box23 out , ,

Next boxes, buttons display pay6 data. All be Box22 input , , and Box24 output
data per line ; sep: ; RUN h
Box24 ; RUN i try [f2] , RUN i , SHOW i

Write whole web page code, click [f1] or [f2] then click RUN j add link?
copy box24 value save to a html file. Cannot display in pay6get2.htm
Box25 ;

QGboxc21.value='' ; ;
<a name=clickGuide1> what can I do? doc1
click , for example; or paste your prime list to box21.
click RUN f to get pay6 form gap sequence.
If box22 has pay6 data, (example , )
click RUN g to recover prime list.

If box22 has pay6 data, click RUN h to
get shorter pay6 data. It is easier to study.
If box22 has pay6 data, click RUN i ,
and click SHOW i to see pay6,gap,prime table.

To build pay6lst0.htm, paste prime data to box21.
click RUN f to get pay6 data in Box22.
Next, click RUN j , save Box24 value to
another html file. Open other html file to view table.
Modify text string and change ### to your need.

<a name=pay6Table>
Pay6 Prime Table 步六素數表
Prime from 2 to 60000011, 3562116 count
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j,
k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, ut, UT;

pay6=pace six, prime gap%6 and parseInt(gap%6)
prime count=###, prime start from ### to ###.
SHOW i ,

Real number calculator ; ; index
Box81 click ex0,ex1,ex2,♫pID then click [real number calculator]

Box81 input Box82 output , , ,

Integer ends ; ,
QPboxc82.value='' ;

<a name=a71117> update 2018-11-17
update 2018-11-17 change code, let whole html page 
output table include pID=primeID column and include 
pay6 string column. 
2018-11-03 first time upload pay6get2.htm did not 
include these two columns. Later do prime gap 
pattern analysis, all prime use its ID, not use 
prime itself. Because pID is shorter and sequential.
pID=0, primeArr[pID]=prime2 
pID=1, primeArr[pID]=prime3 
pID=2, primeArr[pID]=prime5 
pID=3, primeArr[pID]=prime7 
pID=4, primeArr[pID]=prime11 
pID=10, primeArr[pID]=prime31 
pID=100, primeArr[pID]=prime547 
pID=1000, primeArr[pID]=prime7927
pID=10000, primeArr[pID]=prime104743
pID=100000, primeArr[pID]=prime1299721
pID=1000000, primeArr[pID]=prime15485867
pID=3562115, primeArr[pID]=prime60000011
When consider one primeID and its neighbor gaps 
goto pay6lst0.htm ..... pay6lstz.htm need pID 
<a name=a71117b>
How to build table like pay6lst0.htm? 
goto buildPay6Page section. Repeat below. 
To build pay6lst0.htm, paste prime data to box21
If prime list is one line one prime (one long 
column primes) click  change column data 
to row data first. 
click RUN f to get pay6 data in Box22. 
Next, click RUN j , save Box24 value to 
another html file. Open other html file to view 
table. Modify text string and change ### to your 
This version added pID=primeID column. Program 
has NO capability to match prime to right pID. 
Initial pay6lst0.htm output code has several 
"###" in it, these "###" need user to modify. 
(User should also replace with 
 other domain name.) 

<a name=a71117c>
Box24 value has one string as following 
var pIDbgn=3300000; var yz="###change 3300000 to match first prime. "; 
This value 3300000 should be replaced by hand. 
If prime list start from 2,3,5, .....
   set pIDbgn=1, point to 3. 
   prime2 is on top (outside) of table.
If prime list start from 12195257,12195263, .....
   set pIDbgn=800000, point to 12195263 
   prime12195257 is on top (outside) of table.
After build table, user should verify prime to 
pID match condition. Code not verify for you.

<a name=a71212> update 2018-12-12
update 2018-12-12 has minor change. 
Added link T70=


<a name=JavascriptIndex>
Javascript index   local
Save graph code to same folder as htm files.   local

Older Prime number and prime decomposition
jsprime2.htm first upload 2009-09-15

Goldbach conjecture data 6 to 1000

Prime number study notes

Six n Prime Table from n=1 to n=40000
ten table files .....
Six n Prime Table from n=360001 to n=400000

Prime number and prime decomposition (drawing board)
Chinese version 素數函數及整數之素數分解
prime_e1.htm first upload 2016-06-23

Prime number calculator

copy prime_e2.htm to pay6get2.htm

Pay6 Prime number calculator
pay6get2.htm first upload 2018-11-03

Thank you for visiting Freeman's page. 
Freeman Liu,Hsinhan 劉鑫漢 2018-11-02-21-15

Please visit
Please get prime list: