Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukadelic/6378aa588d8dcd5784866b911ae14cf3 to your computer and use it in GitHub Desktop.
Save nukadelic/6378aa588d8dcd5784866b911ae14cf3 to your computer and use it in GitHub Desktop.
Dynamical Uniform Boundedness Conjecture brute force
// as seen on : https://www.youtube.com/watch?v=N92w4e-hrA4
// using : https://github.com/infusion/Fraction.js/blob/master/fraction.min.js
function makeLoop( z, c, loop_limit = 7, max_value = 1000000 )
{
var loop = [ z ];
var calc_func = ( vz, vc ) => vz.mul( vz ).add( vc );
var frac_isValid = x =>
! isNaN( x.n ) && isFinite( x.n ) &&
! isNaN( x.d ) && isFinite( x.d ) ;
var frac_isExploding = x => x.n > max_value || x.d > max_value;
var isValid = true;
var loopIndex = 0;
var current_z = z;
for( var i = 0; i < loop_limit - 1; ++i )
{
var current_z = calc_func( current_z, c );
if( frac_isExploding( current_z ) )
{
// console.log("explode;break;");
isValid = false;
break;
}
if( ! frac_isValid( current_z ) )
{
// console.log("invalid;break;");
isValid = false;
break;
}
var found = loop.find( x => x.equals( current_z ) );
if( found !== undefined )
{
// console.log("found;break;", loop.indexOf( found ) );
loopIndex = loop.indexOf( found );
loop.push( current_z );
break;
}
loop.push( current_z );
}
return ! isValid ? null : {
constant: c,
max_loop_reached : i == max_loop,
loop_index : loopIndex,
loop_size : (loop.length-1) - loopIndex,
list: loop
};
}
function makeLoop2( z_numerator, z_denominator, c_numerator )
{
return makeLoop(
new Fraction( z_numerator, z_denominator ),
new Fraction( c_numerator, z_denominator * z_denominator )
);
}
function testResult( result )
{
if( result == null || result.max_loop_reached ) return;
// result.loop_size of 0 is self repeating number
// result.loop_size of 1 is dual system
// result.loop_size of 2 is triplets
//if( result.list.length > 2 )
if( result.loop_size > 2 )
{
var display = `[${result.loop_size}] c = ${result.constant.toFraction()}`;
result.list.forEach( z => display += `\nz = ${z.toFraction()}` );
console.log( display );
}
}
var depth = 14;
var limit_ijk = 99;
var tested = 0;
for(var i = 1; i < 40; ++i )
for(var j = 12; j < 32; ++j )
for(var k = 100; k < 200; ++k )
{
testResult( makeLoop2( i , j , k , depth ) );
testResult( makeLoop2( -i , j , k , depth ) );
testResult( makeLoop2( i , j , -k , depth ) );
testResult( makeLoop2( -i , j , -k , depth ) );
tested += 4;
}
console.log( "tested count: " + tested );
// c = [ -29/16 ] z = [ 1/4 -> -7/4 -> 5/4 -> 1/4 ]
// c = [ -301/144 ] z = [ 19/12 -> 5/12 -> -23/12 -> 19/12 ]
// c = [ -421/144 ] z = [ 17/12 -> -11/12 -> -25/12 -> 17/12 ]
function test_loop( z, c, count = 5 )
{
var func = ( z, c ) => z.mul( z ).add( c );
console.log( `Starting at z=${z.toFraction()} c=${c.toFraction()}` );
for( var i = 0; i < count; ++i )
{
z = func( z, c );
console.log( `step[${i+2}]: z=${z.toFraction()}` );
}
}
test_loop( new Fraction(5,4), new Fraction(-29,16), 4 );
// Starting at z=5/4 c=-29/16
// step[2]: z=-1/4
// step[3]: z=-7/4
// step[4]: z=5/4
@IamLupo
Copy link

IamLupo commented Nov 13, 2020

I found a lot of example cases. My biggest one is:
z, c = 54833/2964, -3178199389/8785296
-57875/2964
57799/2964
54833/2964

https://pastebin.com/1xBFv08N

I manage to make a really efficient algo because i looked at all the 3 iteration examples and i figure the following.
d = (b^2 - a^2)/(c - b)

a, b and c are the numerator cases for z fractions. d is de denominator for z fractions.

n = (b^2 - a^2)
d = n / (c - b)

What you can conclude is that d and (c - b) are both dividers from n. This makes that you can generate this n value with prime values. When you have all prime factors for n you also can efficiently find all dividers for n. Like you can make d and (c - b) combinations.
Also with the prime factors for n you can make all a and b combinations.

Last part if you want to generate the c fraction you do this:
b*d - (a^2) / d*d

Basicly with this method you reduce your search space a lot to find valid z and c fractions

Here is the project: http://gitlab.ludoruisch.nl/root/Fraction-Iteration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment