Talk:Palindromic gapful numbers: Difference between revisions

m
→‎Nice Recursive Solution/Definition: added a rhetorical query.
m (→‎Nice Recursive Solution/Definition: added a rhetorical query.)
 
(2 intermediate revisions by one other user not shown)
Line 5:
 
:Having calculated an outer 101, the 101 rem 11 == 2 determines permitted inners, in this case only 2, since 2*10 rem 11 is the needed 9. That idea needs generalising to d{0}d*10^k rem n11, ideally passing the outer remainder, needed inner length and trailing zeroes, then we don't actually have to perform any potentially expensive inner remainders at all, and maybe not even on the way in. A few small snippets from a quick experiment yields some clear patterns, both horizontal and vertical:
<pre style="font-size: 8px9px">i=6, j=0, k=3: 3r66=3, 30r66=30, 300r66=36, 3000r66=30, 30000r66=36, 300000r66=30, 3000000r66=36, 30000000r66=30, 300000000r66=36,
i=6, j=1, k=3: 33r66=33, 330r66=0, 3300r66=0, 33000r66=0, 330000r66=0, 3300000r66=0, 33000000r66=0, 330000000r66=0, 3300000000r66=0,
i=6, j=2, k=3: 303r66=39, 3030r66=60, 30300r66=6, 303000r66=60, 3030000r66=6, 30300000r66=60, 303000000r66=6, 3030000000r66=60, 30300000000r66=6,
Line 17:
</pre>
:Obviously there is a fair bit of 30+36=66 and 60+6=66 going on there, however as well as the full dividend it can be say 22, in this case a third of it
<pre style="font-size: 8px9px">
i=6, j=8, k=1: 100000001r66=35, 1000000010r66=20, 10000000100r66=2, 100000001000r66=20, 1000000010000r66=2, 10000000100000r66=20, 100000001000000r66=2, 1000000010000000r66=20, 10000000100000000r66=2,
</pre>
:However, there are also some longer cycles:
<pre style="font-size: 8px9px">i=7, j=0, k=1: 1r77=1, 10r77=10, 100r77=23, 1000r77=76, 10000r77=67, 100000r77=54, 1000000r77=1, 10000000r77=10, 100000000r77=23,
i=7, j=1, k=1: 11r77=11, 110r77=33, 1100r77=22, 11000r77=66, 110000r77=44, 1100000r77=55, 11000000r77=11, 110000000r77=33, 1100000000r77=22,
i=7, j=2, k=1: 101r77=24, 1010r77=9, 10100r77=13, 101000r77=53, 1010000r77=68, 10100000r77=64, 101000000r77=24, 1010000000r77=9, 10100000000r77=13,
Line 34:
:If we have to, we could probably memoise that stuff in a pretty small cache, rather than repeating divisions all the way down.
:Yes, obviously you need to start hunting above the tens of millions before such optimisations would start to kick in. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:09, 4 December 2020 (UTC)
 
::Above is now embodied in 2nd Phix version, though it turned out far more important for accuracy on stupidly large numbers, than for speed. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 23:15, 10 December 2020 (UTC)
 
::: Does &nbsp; ''stupidly large'' &nbsp; numbers fit somewhere between:
:::::: gihugeic
::: and
:::::: ginormous numbers? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -- [[User:Gerard Schildberger|Gerard Schildberger]] ([[User talk:Gerard Schildberger|talk]]) 01:07, 11 December 2020 (UTC)
 
==Please clarify==