C Check record producing runs of primes of the forms 6*k+1 and 6*k-1 C modified to find first runs of exactly n terms C Hugo Pfoertner http://www.pfoertner.org/ C IMPLICIT INTEGER (A-Z) INTEGER PA(50),PE(50),MA(50),ME(50) LOGICAL RUNP, ISPRIM EXTERNAL ISPRIM C C PRESET POINTERS TO FIRST AND LAST TERMS OF CHAIN C (TO AVOID NECESSITY TO CHECK VERY SMALL PRIMES) PA(1) = 7 PE(1) = 7 MA(1) = 5 ME(1) = 5 PA(2) = 31 PE(2) = 37 MA(2) = 23 ME(2) = 29 c DO 5 I = 3, 50 PA(I) = 0 PE(I) = 0 MA(I) = 0 ME(I) = 0 5 CONTINUE LMMAX = 0 LPMAX = 0 LM = 1 LP = 1 RUNP = .FALSE. FIRST = 41 LAST = 41 C DO 10 L = 43, 2147483645, 2 IF ( ISPRIM(L) ) THEN IF ( MOD(L-1,6) .EQ. 0 ) THEN C NEXT PRIME IS OF FORM 6*K+1 IF ( RUNP ) THEN C RUN CONTINUES LP = LP + 1 LAST = L ELSE C RUN FINISHED IF ( MA(LM) .EQ. 0 ) THEN MA(LM) = FIRST ME(LM) = LAST WRITE (*,1000) LM, FIRST, LAST 1000 FORMAT ( ' MINUS:', I3, 2I11 ) ENDIF C IF ( LM .GT. LMMAX ) THEN C WRITE (*,1000) LM, FIRST, LAST C1000 FORMAT ( ' MINUS:', I3, 2I11 ) C LMMAX = LM C ENDIF LP = 1 RUNP = .TRUE. FIRST = L LAST = L ENDIF ELSEIF ( MOD(L+1,6) .EQ. 0 ) THEN C NEXT PRIME IS OF FORM 6*K+1 IF ( .NOT. RUNP ) THEN C RUN CONTINUES LM = LM + 1 LAST = L ELSE C RUN FINISHED IF ( PA(LP) .EQ. 0 ) THEN PA(LP) = FIRST PE(LP) = LAST WRITE (*,1001) LP, FIRST, LAST 1001 FORMAT ( ' PLUS:', I3, 2I11 ) ENDIF C IF ( LP .GT. LPMAX ) THEN C WRITE (*,1001) LP, FIRST, LAST C1001 FORMAT ( ' PLUS:', I3, 2I11 ) C LPMAX = LP C ENDIF LM = 1 RUNP = .FALSE. FIRST = L LAST = L ENDIF ENDIF ENDIF 10 CONTINUE END C******************************************** Results: Combined MINUS: 3 47 59 PLUS: 3 151 163 MINUS: 4 251 269 PLUS: 6 1741 1783 MINUS: 5 1889 1931 PLUS: 4 3049 3079 PLUS: 5 7351 7417 MINUS: 6 7793 7853 PLUS: 7 19471 19531 MINUS: 7 43451 43541 PLUS: 8 118801 118897 PLUS: 10 148531 148663 MINUS: 8 243161 243239 PLUS: 11 406951 407149 PLUS: 9 498259 498397 MINUS: 9 726893 726989 MINUS: 10 759821 759959 MINUS: 12 1820111 1820279 MINUS: 11 2280857 2281001 PLUS: 13 2339041 2339287 PLUS: 12 2513803 2514037 MINUS: 13 10141499 10141751 MINUS: 15 19725473 19725737 MINUS: 14 40727657 40727987 PLUS: 15 51662593 51662869 PLUS: 16 73451737 73452103 PLUS: 14 89089369 89089543 MINUS: 16 136209239 136209551 PLUS: 17 232301497 232301767 MINUS: 18 400414121 400414439 PLUS: 18 450988159 450988567 MINUS: 20 489144599 489145073 MINUS: 17 744771077 744771371 MINUS: 22 766319189 766319627 MINUS: 19 1057859471 1057859837 PLUS: 21 1444257673 1444258219 PLUS: 19 1558562197 1558562653 Sorted 6*k-1 (A055626) MINUS: 1 5 5 MINUS: 2 23 29 MINUS: 3 47 59 MINUS: 4 251 269 MINUS: 5 1889 1931 MINUS: 6 7793 7853 MINUS: 7 43451 43541 MINUS: 8 243161 243239 MINUS: 9 726893 726989 MINUS: 10 759821 759959 MINUS: 11 2280857 2281001 MINUS: 12 1820111 1820279 MINUS: 13 10141499 10141751 MINUS: 14 40727657 40727987 MINUS: 15 19725473 19725737 MINUS: 16 136209239 136209551 MINUS: 17 744771077 744771371 MINUS: 18 400414121 400414439 MINUS: 19 1057859471 1057859837 MINUS: 20 489144599 489145073 MINUS: 22 766319189 766319627 A055626: 5 23 47 251 1889 7793 43451 243161 726893 759821 2280857 1820111 10141499 40727657 19725473 136209239 744771077 400414121 1057859471 489144599 a(21)>2^31, a(22)= 766319189 A085516: Order of first occurrence of a sequence of exactly n consecutive primes of the form 6*k-1. 1 2 3 4 5 6 7 8 9 10 12 11 13 15 14 16 18 20 17 22 19 Sorted 6*k+1 (OEIS A055625) PLUS: 1 7 7 PLUS: 2 31 37 PLUS: 3 151 163 PLUS: 4 3049 3079 PLUS: 5 7351 7417 PLUS: 6 1741 1783 PLUS: 7 19471 19531 PLUS: 8 118801 118897 PLUS: 9 498259 498397 PLUS: 10 148531 148663 PLUS: 11 406951 407149 PLUS: 12 2513803 2514037 PLUS: 13 2339041 2339287 PLUS: 14 89089369 89089543 PLUS: 15 51662593 51662869 PLUS: 16 73451737 73452103 PLUS: 17 232301497 232301767 PLUS: 18 450988159 450988567 PLUS: 19 1558562197 1558562653 PLUS: 21 1444257673 1444258219 A055625: 7,31,151,3049,7351,1741,19471,118801,498259,148531, 406951,2513803,2339041,89089369,51662593,73451737, 232301497,450988159,1558562197 a(20)>2^31, a(21)=1444257673 A085515: Order of first ocurrence of a sequence of exactly n consecutive primes of the form 6*k+1 1 2 3 6 4 5 7 8 10 11 9 13 12 15 16 14 17 18 21 19