Posts by hyper-neutrino
Python 3, 10 bytes 1 .__and__ Try it online! Returns 1 for odd numbers and 0 for even numbers. Two bytes shorter than the trivial lambda x:x%2 and one byte shorter than the equivalent magic...
Python 3, 34 bytes f=lambda x:[f(y)for y in range(x)] Try it online! -9 bytes thanks to Moshi Unfortunately, I cannot use Python sets, because sets are unhashable and thus cannot be put int...
Python 3, 98 bytes print(str(eval("("+input().replace(" ",")*(").replace("i","j")+")")).strip("()").replace("j","i")) Try it online! Since the input format is restrictive, I may as well just...
APL (Dyalog Unicode), 11 bytes (SBCS) 1 1∘⍉+\∘.=⍨ Try it online! This was a fun APL exercise. Working on figuring out how to get it down to 7 bytes.
Jelly, 8 bytes ṖUs2UṭµF Try it online! -1 byte thanks to caird coinheringaahing (Also posted on Stack Exchange by myself) ṖUs2UṭµF Main Link Ṗ pop (remove last element; for numbe...
Jelly, 6 bytes _ÆṣṠ)Ġ Try it online! In order of abundant, perfect, deficient. _ÆṣṠ)Ġ Main Link ) For each from 1 to N _ Subtract Æṣ The proper divisor sum Ṡ Sign ...
Python 2, 33 bytes lambda a,b:reduce(a,range(1,1+b)) Try it online! Or, without using the reduce built-in: Python 2, 37 bytes f=lambda a,b:b-1and a(f(a,b-1),b)or 1 Try it online!
Jelly, 1 byte x Try It Online! x is Jelly's replicate atom. Since Jelly is inspired by languages like J, APL, etc, it is no surprise that is has an atom for a fairly important function.
Python 3, 102 bytes def f(x,y): a=[x] for x in a: if y not in x:return x for i in range(len(x)+1):a+=[x[:i]+x[i+1:]] Try it online! Not exactly the most efficient, but it works. Ju...
Python 3.8 (pre-release), 62 bytes f=lambda x,a=[]:f(x[1:],a+[x[0]]if x[0]else a[:-1])if x else a Try it online! -11 bytes thanks to user