Help with handwritten advanced number system

the human will feel that they have accomplished something

1 Like

he will feel also that he wasted his time to smt that can be done in a lot less time / can be automatically done

‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎‎

1 Like
function CheckEvenOrOdd(x: Number?)
 local val = math.mod(x, 2)
 if val == 1 then
  ifUnEven
 elseif val == 0 then
  ifEven
end

Just use the modulus operator :slight_smile:

function isEven(n)
  local count = 0
  -- We have to make sure this algorithm runs in O(n) time, since 
  -- O(n) is the best run time possible!
  for i = 1, n do
    count = count + 1
  end
  return not ((count / 2) % 1 == 1/2)
end

/s

Why are you even doing this by the way?

Even better:

function IsEven(Number)return Number%2==0;end

Yes, I made it in 1 line, and 45 characters total