Find largest left truncatable prime in a given base: Difference between revisions

m
→‎{{header|Fortran}}: Using a big base for arithmetic.
m (→‎{{header|Perl 6}}: fix some white space issues)
m (→‎{{header|Fortran}}: Using a big base for arithmetic.)
Line 575:
</pre>
 
So, once again, it is plain that using a large BIGBASE is beneficial, probably more so than the convenience of messing with the individual digits in the given base. The plain number version first given works in the computer's own arithmetic base, and preparing such values from the digit strings in the given base is not difficult. Despite the inconvenience of messing with digit sequences not in the same base as used for calculation, a trial run using base 10000 required 260 seconds instead - and gave the same numbers. Bignumber arithmetic via assembler to fully exploit the available hardware would surely do better still.
 
Going further will require MANY to be enlarged. Already, base twelve required just over nineteen thousand entries, and base eighteen overflowed MANY = 66666. This suggests that a lot of data is being shifted about, so some sort of linked-list scheme might reduce that. Incidentally, in <code>B.LAST = A.LAST; B.DIGIT(1:N) = A.DIGIT(1:N)</code> and similar, because the storage for .DIGIT immediately follows that for .LAST, one might hope that an advanced compiler would combine the two statements into one sequential copy... Alas, the Compaq F90/95 compiler produces two wads of code, of 20 operations and then 92. Bounds checking is active, but still...
1,220

edits