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