Anonymous user
Zumkeller numbers: Difference between revisions
m
→{{header|Pascal}}: added "big" non-zumkeller numbers like 10884600 with 72 divisors
m (→{{header|Pascal}}: one partition includes n) |
m (→{{header|Pascal}}: added "big" non-zumkeller numbers like 10884600 with 72 divisors) |
||
Line 2,732:
tDivisors = array of tItem;
tpDivisor = pNativeUint;
//##########################################################
//factors of integer via primedecomposition
var
SmallPrimes: tSmallPrimes;
Line 2,895 ⟶ 2,897:
InsertSort(pDivs,0,len-1);
end;
//factors of integer via primedecomposition
//##########################################################
var
HasSum: array of byte;
Divs:tDivisors;
CheckDivCount: array[0..255] of Uint32;
DIVCOUNTLIMIT : Int32;
function isZumKeller(var Divs:tDivisors;Middle: NativeInt):boolean;
Line 2,928 ⟶ 2,934:
result := false;
end;
function GetZumKeller(n: Uint32): boolean;
var
Line 2,938 ⟶ 2,944:
if Odd(sum) or (sum<2*N) THEN
EXIT(false);
//Now one needs to get the divisors
le := DivCount(primeDecomp);
GetDivs(primeDecomp,Divs);
//erase divisor = n, one partition includes n
Line 2,953 ⟶ 2,959:
else
fillChar(HasSum[0],le,#0);
result := isZumKeller(Divs,sum);
end;
procedure CheckSpecial(n:Uint32);
var
isZK : boolean;
Begin
isZK:=GetZumKeller(n);
writeln(n,' SumOfDivs ',SumOfDiv(primeDecomp),' CountOfDivs ',DivCount(primeDecomp),' isZk ',isZK);
end;
Line 2,963 ⟶ 2,977:
For i := 0 to limit-1 do
begin
write(' ',Sol[i]:colWidth-1);
inc(col);
if col = ColCount then
Line 2,986 ⟶ 3,000:
setlength(HasSum,31);
setlength(sol,MAX+1);
DIVCOUNTLIMIT := 3;
T0 := GetTickCount64;
count := 0;
Line 2,994 ⟶ 3,008:
repeat
if GetZumKeller(n) then
sol[count] := n;
inc(count);
end;
inc(n);
until count = Limit;
OutSol(sol,
For n := 0 to 255 do
if CheckDivCount[n] <> 0 then
writeln(n:4,CheckDivCount[n]:10);
writeln('The first odd 40 zumkeller numbers');
n := 1;
Line 3,034 ⟶ 3,051:
T0 := GetTickCount64-T0;
writeln('runtime ',T0/1000:0:3,' s');
{count of divisors | Number
18 3492
24 14184
30 58596
36 236448
42 954432
54 2549700
72 10884600
}
CheckSpecial(3492);
CheckSpecial(14184);
CheckSpecial(58896);
CheckSpecial(236448);
CheckSpecial(954432);
CheckSpecial(2549700);
CheckSpecial(10884600);
setlength(HasSum, 0);
Line 3,040 ⟶ 3,073:
{{out}}
<pre>TIO.RUN
The first 220 zumkeller numbers
6 12 20 24 28
56 60 66 70 78 80 84 88 90 96
102 104 108 112 114 120 126 132 138 140 150 156 160 168 174 176 180 186 192 198▼
102 104 108 112 114 120 126 132 138 140
204 208 210 216 220 222 224 228 234 240 246 252 258 260 264 270 272 276 280 282▼
294 300 304 306 308 312 318 320 330 336 340 342 348 350 352 354 360 364 366 368▼
204 208 210 216 220 222 224 228 234 240
372 378 380 384 390 396 402 408 414 416 420 426 432 438 440 444 448 456 460 462▼
464 468 474 476 480 486 490 492 496 498 500 504 510 516 520 522 528 532 534 540▼
294 300 304 306 308 312 318 320 330 336
544 546 550 552 558 560 564 570 572 580 582 588 594 600 606 608 612 616 618 620▼
624 630 636 640 642 644 650 654 660 666 672 678 680 684 690 696 700 702 704 708▼
372 378 380 384 390 396 402 408 414 416
714 720 726 728 732 736 740 744 750 756 760 762 768 770 780 786 792 798 804 810▼
812 816 820 822 828 832 834 836 840 852 858 860 864 868 870 876 880 888 894 896▼
464 468 474 476 480 486 490 492 496 498
906 910 912 918 920 924 928 930 936 940 942 945 948 952 960 966 972 978 980 984▼
544 546 550 552 558 560 564 570 572 580
624 630 636 640 642 644 650 654 660 666
714 720 726 728 732 736 740 744 750 756
812 816 820 822 828 832 834 836 840 852
906 910 912 918 920 924 928 930 936 940
The first odd 40 zumkeller numbers
The first odd 40 zumkeller numbers not ending in 5
81081 153153 171171 189189 207207 223839 243243 261261
279279 297297 351351 459459 513513 567567 621621 671517
729729 742203 783783 793611 812889 837837 891891 908523
3492 SumOfDivs 8918 CountOfDivs 18 isZk FALSE
14184 SumOfDivs 38610 CountOfDivs 24 isZk FALSE
58896 SumOfDivs 165230 CountOfDivs 30 isZk FALSE
236448 SumOfDivs 673218 CountOfDivs 36 isZk FALSE
954432 SumOfDivs 2737358 CountOfDivs 42 isZk FALSE
2549700 SumOfDivs 7994714 CountOfDivs 54 isZk FALSE
10884600 SumOfDivs 36560160 CountOfDivs 72 isZk FALSE
Real time: 0.659 s CPU share: 99.05 %
▲runtime 0.371 s
</pre>
|