Penholodigital squares: Difference between revisions

m
→‎{{header|Free Pascal}}: Calc GCD of deltas between the roots.Mostly not 1.
(Added Go)
m (→‎{{header|Free Pascal}}: Calc GCD of deltas between the roots.Mostly not 1.)
Line 246:
=={{header|Pascal}}==
==={{header|Free Pascal}}===
nearly copy and paste of pandigital square numbers.base 17 none found.Base 18 starts late, base 19 no start found within 20 min.<BR>
Calc GCD of deltas between the roots.Mostly not 1.<BR>
<syntaxhighlight lang="pascal">
base 17 none found.Base 18 starts late, base 19 no start found within 20 min.
program penholodigital;
<syntaxhighlight lang="pascal">program penholodigital;
//Find the smallest number n to base b, so that n*n includes all
//digits of base b without 0
Line 264 ⟶ 265:
var
sl : array of string;
s2Delta : array of Uint32;
Num,
sqr2B,
deltaNum : tNumtoBase;
 
function gcd(A, B: Uint32): Uint32;
var
Rest: Uint32;
begin
while B <> 0 do
begin
Rest := A mod B;
A := B;
B := Rest;
end;
Result := A;
end;
 
procedure Conv2num(var num:tNumtoBase;n:Uint64;base:NativeUint);
Line 391 ⟶ 406:
Begin
setlength(sl,740);
setlength(s2Delta,740);
//number containing 1,2..,base-1
n := 0;
Line 416 ⟶ 432:
Begin
IncNumBig(num,i);
sls2delta[penHoloCnt] := OutNum(Num)+'^2 = '+OutNum(sqr2B)i;
sl[penHoloCnt] := Format('%s^2 = %s',[OutNum(Num),OutNum(sqr2B)]);
inc(penHoloCnt);
i := 0;
Line 425 ⟶ 442:
inc(i);
until sqr2B.ntb_cnt >= base;
Writeln('There are a total of ',penHoloCnt,' penholodigital squares in base: ',base:2);
if (penHoloCnt > 0) AND (base < 14) then
Line 438 ⟶ 456:
write(',',sl[j]);
writeln;
end;
else
if penHoloCnt > 0 then
begin
writeln(sl[0],',',sl[penHoloCnt-1]);
end;
j := 1;
IF penHoloCnt> 4 then
Begin
//omit first delta s2delta[0], caused by estimaing first value
j := gcd(s2delta[1],s2delta[2]);
For i := penHoloCnt-1 downto 3 do
begin
j := gcd(s2delta[i],j);
IF j = 1 then
BREAK;
end;
end;
writeln('GGT of delta :',j);
 
end;
 
Line 454 ⟶ 492:
{{out|@TIO.RUN}}
<pre style="height:40ex;overflow:scroll;">
 
There are a total of 1 penholodigital squares in base: 2
1^2 = 1
GCD of delta :1
There are a total of 0 penholodigital squares in base: 3
GCD of delta :1
There are a total of 0 penholodigital squares in base: 4
GCD of delta :1
There are a total of 0 penholodigital squares in base: 5
GCD of delta :1
There are a total of 2 penholodigital squares in base: 6
122^2 = 15324,221^2 = 53241
GCD of delta :1
There are a total of 1 penholodigital squares in base: 7
645^2 = 623514
GCD of delta :1
There are a total of 1 penholodigital squares in base: 8
2453^2 = 6532471
GCD of delta :1
There are a total of 10 penholodigital squares in base: 9
3825^2 = 16328547,3847^2 = 16523874,4617^2 = 23875614
Line 470 ⟶ 516:
6844^2 = 53184267,7285^2 = 58624317,7821^2 = 68573241
8554^2 = 82314657
GCD of delta :4
There are a total of 30 penholodigital squares in base: 10
11826^2 = 139854276,12363^2 = 152843769,12543^2 = 157326849
Line 481 ⟶ 528:
26733^2 = 714653289,27129^2 = 735982641,27273^2 = 743816529
29034^2 = 842973156,29106^2 = 847159236,30384^2 = 923187456
GCD of delta :3
There are a total of 20 penholodigital squares in base: 11
42045^2 = 165742A893,43152^2 = 173A652894,44926^2 = 18792A6453
Line 489 ⟶ 537:
86074^2 = 6713498A25,89468^2 = 7148563A29,91429^2 = 76315982A4
93319^2 = 795186A234,A3A39^2 = 983251A764
GCD of delta :10
There are a total of 23 penholodigital squares in base: 12
117789^2 = 135B7482A69,16357B^2 = 23A5B976481,16762B^2 = 24AB5379861
Line 498 ⟶ 547:
2B0144^2 = 8617B35A294,307381^2 = 93825A67B41,310828^2 = 96528AB7314
319488^2 = 9AB65823714,319A37^2 = 9B2573468A1
GCD of delta :11
There are a total of 0 penholodigital squares in base: 13
GCD of delta :1
There are a total of 160 penholodigital squares in base: 14
1129535^2 = 126A84D79C53B,3A03226^2 = DB3962A7541C8
GCD of delta :13
There are a total of 419 penholodigital squares in base: 15
4240C58^2 = 12378DA5B6EC94,EE25E4A^2 = ED4C93285671BA
GCD of delta :14
There are a total of 740 penholodigital squares in base: 16
11156EB6^2 = 123DA7F85BCE964,3FD8F786^2 = FEC81B69573DA24
Total runtime in s 50.755
GCD of delta :15
Total runtime in s 50.755873
 
@home:
@home:Total runtime in s 18.130
There are a total of 0 penholodigital squares in base: 17 ( 1min 47 for this )
Starting base 18 takes a lot of time
base 18 delta
Line 514 ⟶ 571:
112237HG2^2 = 1258FDG67B9CHE3A4 17,051
1122775FB^2 = 1259637EGF84AHBCD 416,007
....stopped // GCD of delta 17 ? )
base 19 no startvalue after 20 min..
</pre>
132

edits