# Return to Answer

 5 added 1108 characters in body edited Mar 17 '14 at 17:58 C5H8NNaO4 1,31066 silver badges1717 bronze badges Javascript Given the following formula Which looks like this when plotted An implementation in JavaScript function f(a) { var b=(a%6)-3; return ((1 - ~~(((a%6)+1)/(1<<2))) * (Math.pow (2,((a%6)+2)) - (~~(((a%6)+1)/3)))) + (~~(((a%6)+1)/(1<<2))*((2<<3)+(2<<2)*b*b-Math.pow(6,b*(b-1)/2)*Math.round(b/2))) } for (i=0;;i=(i+1) % Math.pow (2,52)) console.log (f (i)) }  Using this formula The fomula basically does the followingfunction f(x) { var value = 0; x = 1 + (x % 0); if (x < 3) { value += 2^(x+3); //0:4, 1:8, 2:16, 3:0, 4:0, 5:0 if (x > 2) { value -= 1 //0:0, 1:0, 2:1, 3:0, 4:0, 5:0 } } else { value += 16; //0:0, 1:0, 2:0, 3:16, 4:16, 5:16 value += 8 * (x-3)^2 //0:0, 1:0, 2:0, 3:0, 4:8, 5:32 value -= ( 6 ^ ((x-3) - (x-4))) * round ((x-3)/2) //0:0, 1:0, 2:0, 3:0, 4:1, 5:6 } return value; }  I don't know if that's the right way to construct a formula, but since i never studied math nor did something like this before, this was the only thing i could come up with. I was actually pretty surprised that you can give your algebra somewhat like a control flow. Took me a while to figure this out though This is how it looks when you draw it It looks a lot less chaotic than i thought for not whole numbers Javascript Given the following formula Which looks like this when plotted An implementation in JavaScript function f(a) { var b=(a%6)-3; return ((1 - ~~(((a%6)+1)/(1<<2))) * (Math.pow (2,((a%6)+2)) - (~~(((a%6)+1)/3)))) + (~~(((a%6)+1)/(1<<2))*((2<<3)+(2<<2)*b*b-Math.pow(6,b*(b-1)/2)*Math.round(b/2))) } for (i=0;;i=(i+1) % Math.pow (2,52)) console.log (f (i)) }  Javascript function f(a) { var b=(a%6)-3; return ((1 - ~~(((a%6)+1)/(1<<2))) * (Math.pow (2,((a%6)+2)) - (~~(((a%6)+1)/3)))) + (~~(((a%6)+1)/(1<<2))*((2<<3)+(2<<2)*b*b-Math.pow(6,b*(b-1)/2)*Math.round(b/2))) } for (i=0;;i=(i+1) % Math.pow (2,52)) console.log (f (i)) }  Using this formula The fomula basically does the followingfunction f(x) { var value = 0; x = 1 + (x % 0); if (x < 3) { value += 2^(x+3); //0:4, 1:8, 2:16, 3:0, 4:0, 5:0 if (x > 2) { value -= 1 //0:0, 1:0, 2:1, 3:0, 4:0, 5:0 } } else { value += 16; //0:0, 1:0, 2:0, 3:16, 4:16, 5:16 value += 8 * (x-3)^2 //0:0, 1:0, 2:0, 3:0, 4:8, 5:32 value -= ( 6 ^ ((x-3) - (x-4))) * round ((x-3)/2) //0:0, 1:0, 2:0, 3:0, 4:1, 5:6 } return value; }  I don't know if that's the right way to construct a formula, but since i never studied math nor did something like this before, this was the only thing i could come up with. I was actually pretty surprised that you can give your algebra somewhat like a control flow. Took me a while to figure this out though This is how it looks when you draw it It looks a lot less chaotic than i thought for not whole numbers 4 added 290 characters in body edited Mar 17 '14 at 11:47 C5H8NNaO4 1,31066 silver badges1717 bronze badges Javascript Given the following formula Which looks like this when plotted An implementation in JavaScript function f(xa) { var u=x-b=(1<<2a%6); -3;   return (((2<3~~(x/(1<<2)))*((2<<3)+((2<<2)*(u)*(u))-(Math.pow((6),(u * (u - 1) / 2))*Math.round (u/2))))) } for (i=1;;i=(i%6)+1)console.log (f (i))  Javascript function f(x) { u=x-(1<<2); return (((2<3)*((2<<3)+((2<<2)*(u)*(u))-(Math.pow((6),(u * (u - 1) / 2))*Math.round (u/2))))) } for (i=1;;i=(i%6)+1)console.log (f (i))  Javascript function f(x) { u=x-(1<<2); return (((2<