User:Tommyaweosme/function

From Esolang
Jump to navigation Jump to search

The tommyaweosme function goes like this:

  • Take any input (can be predetermined numbers for no input languages)
  • Add 5
  • Multiply by 2
  • Subtract 10 repeatedly until below 10
  • If answer is 0, output 87 once.
  • Otherwise, repeatedly output 56.

Implementations

The following Python script defines the tommyaweosme function.

def tommyaweosme(n):
    n += 5
    n *= 2
    while n >= 10:
        n -= 10
    if n == 0:
        print(87)
    else:
        while True:
            print(56)

The following Python script makes the tommyaweosme function an O(1) problem.

def tommyaweosme(n):
    if n % 5 == 0:
        print(87)
    else:
        while True:
            print(56)