Tupper's self-referential formula: Difference between revisions
Content added Content deleted
(→{{header|ALGOL 68}}: Remove unnecessary line) |
(→{{header|Lua}}: Tweak) |
||
Line 157: | Line 157: | ||
=={{header|Lua}}== |
=={{header|Lua}}== |
||
Tested with Lua 5.4. |
Tested with Lua 5.4.6 |
||
{{Trans|Algol 68}} |
{{Trans|Algol 68}} |
||
Using Eduardo Bart's lua-bint pure Lua big integer library https://github.com/edubart/lua-bint.<br> |
Using Eduardo Bart's lua-bint pure Lua big integer library https://github.com/edubart/lua-bint.<br> |
||
The precision of the big integers must be specified in bits as a parameter of the require. |
The precision of the big integers must be specified in bits as a parameter of the require. |
||
<syntaxhighlight lang="lua"> |
<syntaxhighlight lang="lua"> |
||
do -- |
do -- plot Tupper's self-referential formula |
||
--[[ need to find x, y such that: |
|||
1/2 < floor( mod( (y/17)*2^ - ( 17x - mod(y,17) ), 2 ) ) |
1/2 < floor( mod( (y/17)*2^ - ( 17x - mod(y,17) ), 2 ) ) |
||
where x in 0..106, y in k..k+16 |
where x in 0..106, y in k..k+16 |
||
--]] |
--]] |
||
⚫ | |||
⚫ | |||
local k = bint.fromstring( "960939379918958884971672962127852754715004339660129306651505" .. |
local k = bint.fromstring( "960939379918958884971672962127852754715004339660129306651505" .. |
||
Line 181: | Line 180: | ||
"719" ) |
"719" ) |
||
local |
local b2 = bint.frominteger( 2 ) |
||
local b17 = bint.frominteger( 17 ) |
local b17 = bint.frominteger( 17 ) |
||
local |
local kMod17 = bint.tointeger( k % b17 ) |
||
for yDelta = 0, 16 do |
for yDelta = 0, 16 do |
||
for x = 106, 0, -1 do |
for x = 106, 0, -1 do |