Jump to content

Increasing gaps between consecutive Niven numbers: Difference between revisions

m
→‎{{header|Pascal}}: Limit 1e12 tested
m (removed the forcing of the placement of the TOC (table of contents).)
m (→‎{{header|Pascal}}: Limit 1e12 tested)
Line 356:
276 1,039,028,518 18,879,988,824
real 2m37,350s
 
 
Limit = 1e12 hoped for 9,879,997,824 * 100
used array of function
function NumMod3(n:NativeUInt):NativeUInt;Begin result:=n-(n DIV 3)*3;end;
function NumMod4(n:NativeUInt):NativeUInt;Begin result:=n-(n DIV 4)*4;end;
..
function NumMod216(n:NativeUInt):NativeUInt;Begin result:=n-(n DIV 216)*216;end
..
assign the functions
FModN[1] := @NumMod1;
FModN[2] := @NumMod2;
 
leads to:
repeat
num += 1;
sum:= NextSum(sum,@sd.sdDigits[0]);
until FModN[Sum](Num) = 0;
//until (Num MOD Sum) = 0;// div is slow waiting for Intel Ice-Lake 18 cycles/64Bit instead of 97?
 
 
276 1,039,028,518 18,879,988,824
294 14,192,408,715 286,889,989,806
300 14,761,794,180 299,989,897,728
312 19,274,919,138 394,899,998,808
326 19,404,508,330 397,999,889,616
420 23,690,581,129 489,987,799,644
453 37,472,300,164 799,799,878,437
 
real 68m44,463s //15,26 cpu-cycles per number
</pre>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.