Sexy primes: Difference between revisions
Content deleted Content added
Line 1,057: | Line 1,057: | ||
table.lastn = function(t,n) local s=T{} n=n>#t and #t or n for i = 1,n do s[i]=t[#t-n+i] end return s end |
table.lastn = function(t,n) local s=T{} n=n>#t and #t or n for i = 1,n do s[i]=t[#t-n+i] end return s end |
||
table.each = function(t,f,...) for _,v in ipairs(t) do f(v,...) end end |
table.each = function(t,f,...) for _,v in ipairs(t) do f(v,...) end end |
||
table.tohash = function(t) local h={} for i=1,#t do h[t[i]]=t[i] end return h end |
|||
-- PRIMES: |
-- PRIMES: |