Jump to content

Euler's sum of powers conjecture: Difference between revisions

→‎{{header|QL SuperBASIC}}: more concise initialisation
(→‎{{header|QL SuperBASIC}}: more concise initialisation)
Line 3,167:
 
=={{header|QL SuperBASIC}}==
This program enhances a modular brute-force search posted on fidonet in the 1980s via number theoretical enhancements as used by
This program is a modification of one posted on fidonet in the 1980s so as to use the identical control framework as used for ZX Spectrum BASIC, but without the early exit in the last loop so as to be backward-compatible with the lack of floating point in Sinclair ZX80 BASIC (whereby the latter is truly 'zeroeth' generation). So that it will run on a ZX80 (with a 16K RAM pack & some MODification) & complete the task sooner than the one for the Spectrum, it relies entirely on integer functions, their upper limit being 2^15- 1 in ZX80 BASIC as well. Thus, the "slide rule" calculation of each percentage on the Spectrum is replaced by that of least significant digits across "abaci" of distinct bases Pi. Given that each Pi is to be <= 2^7 for said limit's sake, it will take at least six prime numbers or powers thereof to serve as bases of such a mixed-base number system, since it is necessary that ΠPi > 249^5 for unambiguous representation. The difference between successive bases is successive powers of 2, so that one can more easily convert (esp. via assembly, as just shifts & subtractions will be needed) between base 2^7 & mixed-base representations as character strings. In disproving Euler's conjecture, the program demonstrates that using 60 bits of integer precision in 1966 was 2-fold overkill, or even more so in terms of overhead cost vis-a-vis contemporaneous computers less sophisticated than a CDC 6600.
the program listed under ZX Spectrum Basic--but without the early exit in the control framework so as to be backward-compatible
with the lack of floating point in Sinclair ZX80 BASIC (whereby the latter is truly 'zeroeth' generation). So that it will run on a
ZX80 (with a 16K RAM pack & some MODification) & complete the task sooner than than that for an unexpanded Spectrum, it relies
entirely on integer functions, their upper limit being 2^15- 1 in ZX80 BASIC as well. Thus, the "slide rule" calculation of each
percentage on the Spectrum is replaced by that of least significant digits across "abaci" of relatively prime bases Pi. Given that
each Pi is to be <= 2^7 for said limit's sake, it will take at least six prime numbers or powers thereof to serve as bases of such
a mixed-base number system, since it is necessary that ΠPi > 249^5 for unambiguous representation. The difference between
successive bases is successive powers of 2, so that one can more easily convert (esp. via assembly, as just shifts & subtractions
will be needed) between base 2^7 & mixed-base representations as character strings. In disproving Euler's conjecture, the program
demonstrates that using 60 bits of integer precision in 1966 was 2-fold overkill, or even more so in terms of overhead cost
vis-a-vis contemporaneous computers less sophisticated than a CDC 6600.
 
<lang qbasic>
1 CLS
Line 3,175 ⟶ 3,187:
5 LET t%=48
6 FOR m=0 TO 6: READ n%(m)
78 FOR j=1 TO 255: i%(j,0)=j MOD 30
9 FOR i%(j,0)=1j TOMOD 25530
10 FOR m=1 TO 6
11 LET i%(j,m)=j MOD n%(m)
Cookies help us deliver our services. By using our services, you agree to our use of cookies.