EINE

From Esolang
Jump to navigation Jump to search

EINE is an esolang invented by User:None1, inspired by NULL. EINE means 1 in German, as opposed to NULL, which means 0.

Instructions

EINE has all the instructions in NULL, but unlike NULL, it has one dimension.

2 Select the next queue (wrapping around).
3 Select the previous queue (wrapping around).
5 Output the byte at the front of the selected queue (NUL if the queue is empty). NUL is '\0' (ASCII character 0).
7 Input one byte and replace the value at the front of the selected queue with it; or, if the selected queue is empty, enqueue the value there. It is currently undefined what to do when EOF has been reached.
11 Subtract the byte at the front of the selected queue (0 if the queue is empty) from y. If this makes y less than zero, y is set to 0.
13 Add the byte at the front of the selected queue (0 if the queue is empty) to y.
17 Add y mod 256 to the byte at the front of the selected queue, or enqueue y mod 256 there if the queue is empty.
19 Remove the byte at the front of the selected queue (use 0 if the queue is empty) and enqueue it to the rear of the next queue (wrapping around).
23 Remove the byte at the front of the selected queue (use 0 if the queue is empty) and enqueue it to the rear of the previous queue (wrapping around).
29 Remove the byte at the front of the selected queue.
31 Enqueue y mod 256 at the end of the selected queue.
37 If the selected queue is empty or the byte at the front of it has a value of 0, divide x by its smallest prime factor and multiply y by that number.
41 Switch the values of x and y.
43 End the program.

The instructions loop for every 14th prime number, meaning, for instance, 47 is equivalent to 2.

Instructions are prime numbers, and are separated by spaces.

Examples

These examples are factorized from the NULL programs.

Hello, World!

3 3 3 17 31 73 127 139 167 227 277 283 283 311 389 449 449 463 491 491 571 631 643 653 719 751 823 907 941 947 1019 1031 1033 1039 1103 1163 1237 1303 1381 1481 1553 1613 1657 1667 1709 1753 1847 1867 1867 1877 1993 1993 2063 2113 2207 2281 2297 2311 2377 2437 2477

Note that because this esolang is 1D,

3 3 3 17 31 17 5 13 31 17 5 11 11 19 17 5 5 13 29 29 17 5 11 17 3 17 5 2 13 17 5 11 13 17 5 29 17 5 31 29 17 5 19 29 2 17 5 11 11 19 17 17 5 31 17 5 13 19 3 31 5

Also works.

Cat program

7 59 103

Truth Machine

7 59 71 97 139 151 227 227 251 263 307 331 383 397 463 523 607

Implementations

The following is an EINE converter to NULL in Python, by User:None1. It requires the sympy package.

from sympy import isprime,primepi
k=list(map(int,input().split()))
z=2
r=1
p=1
for i in k:
    w=primepi(i)%14
    while p%14!=w:
        z+=1
        if isprime(z):
            p+=1
    r*=z
print(r)

And a NULL to EINE converter, makes use of EINE being 1D:

from sympy import factorint,primerange,primepi
k=factorint(int(input()))
p=list(primerange(0,44))
for i,j in k.items():
    for l in range(j):
        print(p[(primepi(i)-1)%14],end=' ')