Gödel Number

Author

Eric W. Weisstein
April 16, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/ComputationalSystems/GoedelNumber.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/GoedelNumber.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

GoedelNumber[l_List]:=Times@@MapIndexed[Prime[First[#2]]^#1&,l]
GoedelNumber2[l_List]:=Product[Prime[i]^l[[i]],{i,Length[l]}]

Encoding a List

2^2 3^5 5^4

Through[{GoedelNumber,GoedelNumber2}[{2,5,4}]]

t=Table[Random[Integer,{1,20}],{5000}];

GoedelNumber[t];//Timing

GoedelNumber2[t];//Timing