pouët.net

Math question

category: general [glöplog]
Is it possible to find a mathematical operation for a sequence of any five numbers that would produce it? Just like in popular mathematical riddles where you have to understand how the number row was produced.

Let's say we have 5 random numbers: 3, 7, 6.7, 8, 9
Can a mathematical operation be synthesized that produces this sequence?
Code: x=0 x=x+1; x=x+1; x=x+1 y=x; y=y+1; y=y+1; y=y+1; y=y+1 z=y-x/10 u=y+1 v=u+1 print (x,y,z,u,v)


maybe this example helps you understand why your question is meaningless.
added on the 2008-12-05 16:28:58 by blala blala
from old amycoder site, excellent article:
http://membres.lycos.fr/amycoders/tutorials/rndintro.html
added on the 2008-12-05 16:37:23 by krabob krabob
will you post a bunny if i tell you that you can rewrite blabla comment as a number? pliiiiis
added on the 2008-12-05 16:41:29 by makc makc
and the true question: what is randomness ?
added on the 2008-12-05 16:42:21 by krabob krabob
BB Image
added on the 2008-12-05 16:44:58 by blala blala
fenk-u
added on the 2008-12-05 16:45:44 by makc makc
an interesting problem could be:

this is an uniform ransom sequence generator:
X[ i+1 ] = A * X[ i ] % M;

find X[0], A and M, so that it gives 3, 7, 6.7, 8, 9.
added on the 2008-12-05 16:46:38 by krabob krabob
ransom ->ranDom
added on the 2008-12-05 16:46:58 by krabob krabob
hm, is that a bunny or is it PinkFloyds' pig after landing?
added on the 2008-12-05 16:47:29 by makc makc
6.7
versus
integer pseudorandom generator using linear congruences
:)
added on the 2008-12-05 16:48:34 by blala blala
the perfect random number generator:
Code:def rand(): Int = 7
added on the 2008-12-05 16:48:42 by src src
it's a bunny, of course!
added on the 2008-12-05 16:48:55 by blala blala
BB Image
added on the 2008-12-05 16:52:55 by makc makc


0=(x-3)(x-7)(x-6.7)(x-8)(x-9)
=>
x=3 & 7 & 6.7 & 8 & 9
KR: I am glad you wrote it is a ransom generator because clearly it is not a random uniform generator.
added on the 2008-12-05 17:21:45 by Hatikvah Hatikvah
The short answer is no, there isn't a simple mathematical operation for pattern recognition. ;)

But you can always construct an (n-1)th degree polynomial that touches n points:

f(0) = 3
f(1) = 7
f(2) = 6.7
f(3) = 8
f(4) = 9

There's guaranteed to be a function of the form f(x) = ax^4+bx^3+cx^2+dx+e that satisfies all five. But... I think the point of those riddles is to try and find a simple answer using intuition and stuff. And this method wouldn't really work for a series like 1,2,1,2,1 (the 6th number wouldn't be what you expect). It would work for 1,2,3,4,5 though.
added on the 2008-12-05 17:25:58 by doomdoom doomdoom
what doom said !
random is random and stays random! applies to that "bunny" aswell,haha !
if you would find a randomizer fed with the right numbers and would get what you´ve been searching for this would be more luck than winning in any lottery!
"Is it possible to find a mathematical operation for a sequence of any five numbers that would produce it?"

yes. good luck. :)
added on the 2008-12-05 18:51:44 by Oswald Oswald
BB Image
added on the 2008-12-05 21:20:46 by px px
Quote:
KR: I am glad you wrote it is a ransom generator because clearly it is not a random uniform generator.

In the article I link on the top of the page, the guy (who seems to know its stuff) write it is one of the best formula to approximate it. That's what behind rand() AFAIK, and I use that as random generator in my intros.
added on the 2008-12-05 22:48:37 by krabob krabob
Command Cyborg: hmm... interesting, thx! You seem to be the only one here who got my point
Here is a little IQ-alike test series solver I did some time ago. It doesn't have fibonacci series knowlegde nor prime numbers knowledge, just very simple series, but it could be very easy to update. Anyway it is not *exactly* what you are asking for, but... this is my oportunity to publish this code! (It is PHP)

Code:<?php $solution=array(); function solve($serie,$ply) { global $solution; $solution_found="1"; $n=0; foreach ($serie as $value) { if ($value!="1") $solution_found="0"; $n++; } if ($n<1) $solution_found="0"; if ($solution_found) { $inv_sol = array_reverse($solution); $c=0; $sol=1; foreach ($inv_sol as $value) { if (($c%2)==0) { $k=$value; } else { if ($value=="/") $sol*=$k; else $sol+=$k; } $c++; } echo "SOLUTION FOUND: ".$sol."<br>"; } else { if ($ply>0) { $serie_sub=array(); $serie_div=array(); $n=0; $zero_div=0; foreach ($serie as $value) { if ($n>0) { array_push($serie_sub, $value-$old_value); if ($old_value!=0) { array_push($serie_div, $value/$old_value); } else { $zero_div=1; } } $old_value=$value; $n++; } array_push($solution, "-"); array_push($solution, $serie[$n-1]); solve($serie_sub, $ply-1); array_pop($solution); array_pop($solution); if ($zero_div==0) { array_push($solution, "/"); array_push($solution, $serie[$n-1]); solve ($serie_div, $ply-1); array_pop($solution); array_pop($solution); }; } } } $serietxt=$HTTP_GET_VARS["serietxt"]; if ($serietxt) { $serie=array(); $item=strtok($serietxt," "); while ($item) { array_push($serie, $item); $item=strtok(" "); } solve($serie,7); echo "<br>done"; } else { echo ' Write a numerical serie like:<br> 1 2 3 4 5 6<br><br> <form> <input name="serietxt"><input type=submit> </form> '; } ?>
added on the 2008-12-07 15:34:38 by texel texel
In that case, to find the function, set up the following system of equations:

Code:f(0) = a*0^4 + b*0^3 + c*0^2 + d*0^1 + e*0^0 = e f(1) = a*1^4 + b*1^3 + c*1^2 + d*1^1 + e*1^0 = a + b + c + d + e f(2) = a*2^4 + b*2^3 + c*2^2 + d*2^1 + e*2^0 = 16a + 8b + 4c + 2d + e f(3) = a*3^4 + b*3^3 + c*3^2 + d*3^1 + e*3^0 = 81a + 27b + 9c + 3d + e f(4) = a*4^4 + b*4^3 + c*4^2 + d*4^1 + e*4^0 = 256a + 64b + 16c + 4d + e


Or, in matrix form: b = Ax, Where b is the vector [ f(0), ..., f(4) ]^T and, x = [ a, b, c, d, e ]^T and A is the matrix:

Code: 0 0 0 0 1 1 1 1 1 1 16 8 4 2 1 81 27 9 3 1 256 64 16 4 1


Your general solution is x = A^(-1) b.

A^(-1) is the inverse of A and a bitch to work out manually, but since A is constant you only need to do it once, and a maths package can do the hard work. Maple gave me this: A^(-1) =

Code: 1/24 -1/6 1/4 -1/6 1/24 -5/12 3/2 -2 7/6 -1/4 35/24 -13/3 19/4 -7/3 11/24 -25/12 4 -3 4/3 -1/4 1 0 0 0 0


So, for any set of five numbers, f(0), ..., f(4) the 4th-degree polynomial that ties them together is given by the function:

Code:f(x) = ax^4 + bx^3 + cx^2 + dx + e


where:

Code:a = 1/24 * f(0) - 1/6 * f(1) + 1/4 * f(2) - 1/6 * f(3) + 1/24 * f(4) b = -5/12 * f(0) + 3/2 * f(1) + ... (and so on)


For the five numbers you gave the function you end up with is:

Code:f(x) = (-13/40)x^4 + (44/15)x^3 + (-347/40)x^2 + (151/15)x + 3
added on the 2008-12-07 15:57:18 by doomdoom doomdoom
(Please ignore the confusion from x being first a vector and then a scalar. They're meant as two different variables.)
added on the 2008-12-07 15:59:38 by doomdoom doomdoom

login