![]() |
|
|
#12 |
|
Aug 2006
3×1,993 Posts |
I would track the index, incrementing by 1 each time. Then when you come to output, either output only the index, or else output the index followed by the full number.
I would also remove prime_file (in both places) since you don't seem to use it. |
|
|
|
|
|
#13 |
|
"Mark"
Apr 2003
Between here and the
635410 Posts |
Is it possible for an to go negative? If not, but it is in code, then you have problem.
|
|
|
|
|
|
#14 |
|
Sep 2002
Database er0rr
3,761 Posts |
this tests for negative "an":
Code:
SCRIPT DIM anm1, 8 DIM anm2, 7 DIM anm3, 4 DIM anm4, 1 DIM anmin, 2^1 DIM anmax, 2^300000 DIM an DIM abs_an DIM index_n, 4 OPENFILEAPP prp_file,prp.txt LABEL start SET an,4*anm1-7*anm2+8*anm3-4*anm4 IF (an<0) THEN SET abs_an,-an ELSE SET abs_an,an IF (abs_an<anmin) THEN GOTO next_iteration IF (abs_an>anmax) THEN GOTO the_end FACTORIZE index_n IF (ISPRIME) THEN GOSUB test LABEL next_iteration SET anm4, anm3 SET anm3, anm2 SET anm2, anm1 SET anm1, an SET index_n, index_n+1 GOTO start LABEL test PRP abs_an IF (ISPRP) THEN WRITE prp_file,index_n RETURN LABEL the_end CLOSEFILE prp_file END |
|
|
|
|
|
#15 | |
|
"Sam"
Nov 2016
22×34 Posts |
Quote:
Code:
SCRIPT DIM anm1, 8 DIM anm2, -7 DIM anm3, 4 DIM anm4, 1 DIM anmin, 2^1 DIM anmax, 2^300000 DIM an DIM abs_an DIM index_n, 4 OPENFILEAPP prp_file,prp.txt LABEL start SET an,-4*anm1-7*anm2-8*anm3-4*anm4 IF (an<0) THEN SET abs_an,-an ELSE SET abs_an,an IF (abs_an<anmin) THEN GOTO next_iteration IF (abs_an>anmax) THEN GOTO the_end FACTORIZE index_n IF (ISPRIME) THEN GOSUB test LABEL next_iteration SET anm4, anm3 SET anm3, anm2 SET anm2, anm1 SET anm1, an SET index_n, index_n+1 GOTO start LABEL test PRP abs_an IF (ISPRP) THEN WRITE prp_file,index_n RETURN LABEL the_end CLOSEFILE prp_file END |
|
|
|
|
![]() |
| Thread Tools | |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linear() -> Lucas in pfgw | CRGreathouse | Software | 2 | 2017-06-14 16:05 |
| Efficient testing in Pfgw | Trejack | Information & Answers | 2 | 2016-04-30 05:30 |
| Congruence | storm5510 | Math | 27 | 2009-09-22 23:14 |
| Primality-testing program with multiple types of moduli (PFGW-related) | Unregistered | Information & Answers | 4 | 2006-10-04 22:38 |
| congruence mod 2^p-1 | abiessuunreg | Miscellaneous Math | 3 | 2005-03-07 21:03 |