Talk:Smallest Differences between Fractional Parts of Square and Cube Roots

The code in Pari/GP: y=1;for(i=2,1000000,{x=frac(i^(1/2)-i^(1/3));if(x<y&&x!=0,printf("%u\n%f\n",i,x);y=x);})

gives the output: 2 0.15429251247822188403447811693146972800 10 0.0078429701364956102395999779133680384639 42 0.0047140535214104442261022170834592237132 800 0.0010935802363431912136217823550684183680 1570 0.00071670015618963611244737578937671705410 3087 0.00019077099307359882353305591927123567904 3223 0.00012466199940739396224222806383259287238 14771 0.000029087570472944050280604781912358337501 30739 0.000015123264403485537324746217861195913828 62324 0.000011575707272908687499041005287330203218 147313 0.0000045703848731831388099157950289968827804 149008 0.0000030146447420051098309567216693819302936 568258 0.00000086558489400850481329186187672034447644

A less brute force method is calculating $y = 1 + \floor {x^6}$ for the (real) root of $x^3 - x^2 = n$, $n \in \N$, and only checking $\floor{\sqrt y - \sqrt[3]y}$ for these $y$.

We only need to check these values because $\sqrt y - \sqrt[3]y$ is strictly increasing, but we need to "solve" a cubic.

Indeed this is much faster: y=1;for(i=0,100000,{z=solve(x=1,i+2,x^3-x^2-i);z=floor(1+z^6);x=frac(z^(1/2)-z^(1/3));if(x<y&&x!=0,printf("%u\n%f\n",z,x);y=x);})

gives the output:

2 0.15429251247822188403447811693146972800 10 0.0078429701364956102395999779133680384639 42 0.0047140535214104442261022170834592237132 800 0.0010935802363431912136217823550684183680 1570 0.00071670015618963611244737578937671705410 3087 0.00019077099307359882353305591927123567904 3223 0.00012466199940739396224222806383259287238 14771 0.000029087570472944050280604781912358337501 30739 0.000015123264403485537324746217861195913828 62324 0.000011575707272908687499041005287330203218 147313 0.0000045703848731831388099157950289968827804 149008 0.0000030146447420051098309567216693819302936 568258 0.00000086558489400850481329186187672034447644 5781520 0.00000081127946854979189556181719049994553767 7142707 0.00000065780010368311972839306026076437823006 8260736 0.00000032019600682982970775657159445725631213 15167405 0.00000025914765043422472045608642707358843900 17302647 0.00000022770955998707227611376619039797748733 17748069 0.00000021401297343946172863158406338736302263 18368515 0.00000010153877047848596642664175919935294578 21098622 0.000000097681440377592528716085851194028439373 39613036 0.000000076460190223149325162264813391918394990 41022551 0.000000041535871374840429908879549601827250567 51302476 0.000000021336730803744087432900045717165324766 56143750 0.000000016670145444482060478255370836310394893 171251830 0.000000015061907290533350722056303247241877074 262947407 0.00000000065191479569633480374447053476585426287 1240338144 0.00000000033602710690060077106396217361801553900 1802945312 0.00000000030524606353367716865784992171483162902 2758397060 0.00000000025668214511161219672847521111624969493

This program breezes past two billion in less time than the first program takes to reach a million.

This gives all the terms of the potential sequence under $2 \, 758 \, 397 \, 061$:
 * $2, 10, 42, 800, 1570, 3087, 3223, 14771, 30739, 62324, 147313, 149008, 568258, 5781520, 7142707, 8260736,$
 * $15167405, 17302647, 17748069, 18368515, 21098622, 39613036, 41022551, 51302476, 56143750, 171251830, 262947407, 1240338144, 1802945312, 2758397060$

This sequence is not documented in the OEIS. --RandomUndergrad (talk) 11:17, 30 March 2022 (UTC)


 * With the work that you did, I would suggest to submit this to OEIS for inclusion. In my experience they are quite generous with taking new submissions on board. &mdash; Lord_Farin (talk) 12:58, 30 March 2022 (UTC)


 * Yes indeed, they've got several of mine. Only problem is that their UI is even more fussy about formatting than.


 * Currently this program could be flawed because it does not consider the absolute difference, but assumed the fractional part of $\sqrt x$ is greater than $\sqrt[3] x$. I'll fix this and consider submitting to the OEIS later. --RandomUndergrad (talk) 10:39, 31 March 2022 (UTC)

New programs below:

y=1;for(i=2,1000000,{x=frac(i^(1/2)-i^(1/3));if(x!=0&&(x<y||1-x<y),printf("%u\n%f\n",i,x);y=min(x,1-x));})

with output:

2 0.15429251247822188403447811693146972800 9 0.91991617694809588546994317564211461366 10 0.0078429701364956102395999779133680384639 42 0.0047140535214104442261022170834592237132 367 0.99764523583524492640521609259606829640 661 0.99893752565473920747860296674571892613 1570 0.00071670015618963611244737578937671705410 2448 0.99993930580126039120733696759551010875 8985 0.99996411235892669905400067880417787009 14771 0.000029087570472944050280604781912358337501 30739 0.000015123264403485537324746217861195913828 62324 0.000011575707272908687499041005287330203218 67447 0.99999770189726971675455537543180313250 568258 0.00000086558489400850481329186187672034447644

Second faster program: y=1;for(i=0,10000,{z=solve(x=1,i+2,x^3-x^2-i);z=z^6;a=ceil(z-1);b=floor(z+1);x=frac(a^(1/3)-a^(1/2));if(x<y&&x!=0,printf("a%u\n%f\n",a,x);y=x);x=frac(b^(1/2)-b^(1/3));if(x<y&&x!=0,printf("b%u\n%f\n",b,x);y=x);})

with output:

b2 0.15429251247822188403447811693146972800 a9 0.080083823051904114530056824357885386337 b10 0.0078429701364956102395999779133680384639 b42 0.0047140535214104442261022170834592237132 a367 0.0023547641647550735947839074039317036024 a661 0.0010624743452607925213970332542810738749 b1570 0.00071670015618963611244737578937671705410 a2448 0.000060694198739608792663032404489891254666 a8985 0.000035887641073300945999321195822129907935 b14771 0.000029087570472944050280604781912358337501 b30739 0.000015123264403485537324746217861195913828 b62324 0.000011575707272908687499041005287330203218 a67447 0.0000022981027302832454446245681968674950102 b568258 0.00000086558489400850481329186187672034447644 b5781520 0.00000081127946854979189556181719049994553767 a5822076 0.00000042402432569972163117994207865830617292 b8260736 0.00000032019600682982970775657159445725631213 a9948161 0.00000017488499910580074391459405794344803222 a14293597 0.000000030017266042220161814015992769170135610 b51302476 0.000000021336730803744087432900045717165324766 b56143750 0.000000016670145444482060478255370836310394893

"a" indicates $\{\sqrt[3]x\} > \{\sqrt x\}$; "b" indicates otherwise.

My first programs missed all numbers of type "a".

At the very least the outputs match.

The sequence is now:
 * $2, 9, 10, 42, 367, 661, 1570, 2448, 8985, 14771, 30739, 62324, 67447, 568258, 5781520, 5822076, 8260736, 9948161, 14293597, 51302476, 56143750$

Now it's time to optimize this mess so it doesn't look like someone desperately tried to duplicate the checking sequence for a difference class of numbers. --RandomUndergrad (talk) 11:14, 31 March 2022 (UTC)