Search
Ruby, 58 bytes Simple eval solution. Using ** for exponentiation. ->a,b,c{%w[+ - * / % **].select{eval("#{a}#{_1}#{b}")==c}} Attempt This Online!
Ruby, 27 bytes ->n{(2..n).all?{n%_1**2>0}} Try it online
Ruby, 25 bytes ->e{e.to_c*e[/ .*/].to_c} Try this online!
Ruby, 75 72 bytes f=->((e,*r),n){(i=n.index e)?f[r[0,i],n[...i]]+f[r[i..],n[i+1..]]+[e]:n} Attempt This Online!
Ruby, 50 bytes ->n{n.times{puts (' '*(n-_1)+'_/'+'##'*_1)[3..]}} Attempt This Online!
Scala 3, 553 bytes package a import E.Z as Z import E.* sealed trait T open class Y{export E.Z as Q} enum E[+A]derives CanEqual: case Z end E private abstract final class X extends AnyRef...
JS, 15 bytes !![]/(-~[]-~[]) Basically typed random characters into js console and it worked.
Javascript, 5 Distinct characters, 9 Bytes ~[]/~-~[]
Japt, 1 byte ½ Test it Jelly, Vyxal, 1 byte . Try it online! Yeah, golf langs still kind of kill this challenge.
Scala, 15 bytes '#'.toFloat/'F' Try it in Scastie! Characters in Scala kinda get casted to integers. This is usually annoying, but it's useful when golfing. # is 35 and F is 70, and the .toFlo...
Raku (also Perl polyglot), 5 unique, 13 bytes !()/(!()+!()) () or empty list coerces to its length which is 0 in math operations and !0 is True which coerces to 1
Ruby, 10 distinct, 35 chars t=/%/=~%/=%/ o=/%/=~%/==%/ t/o.to_f
Julia 1.0, 16 bytes (o=one(Int))/-~o Try it online!
J, 4 unique, 4 char -:=_ How it works: -: results in half of what's on the right = results in signum of what's on the right _ is infinity
Ruby 3.1.0, 274 259 249 bytes -10 bytes thanks to Paradox in the Ruby discord BEGIN{END{alias module class begin rescue retry ensure end if self elsif defined? for$.in true do super while f...
brainfuck, 31 bytes ++++++++++[[>]>-[<+>---]<[.<]>] Try it online!
Haskell, 35 bytes main=mapM putStrLn$iterate('*':)"*" Attempt This Online! 55 -> 39, with orthoplex's idea. 39 -> 35 from orthoplex.
Lua 5.4.4, 99 bytes _=0s:gsub('.',function(c)_=({d=_-1,i=_+1;s=_*_})[c]or print(_)or _ _=({[256]=0,[-1]=0})[_]or _ end) Try it online! Thanks to @orthoplex for more shortening.
MATL, 16 bytes 1`1yh1$lZctDwQt] Try it online! The TIO output fetch will likely fail, so make sure to click the run button to stop the execution. 1`1yh1$lZctDwQt] 1` ] - Push 1 o...
Given a number $n \geq 3$ as input output the smallest number $k$ such that the modular residues of $k$ by the first $n$ primes is exactly $\{-1,0,1\}$. That is there is a prime in the first $n$ p...
Simple challenge: Read a byte, swap bit 7 with 0, 6 with 1, 5 with 2 and 4 with 3 and then output the byte. For example the byte 0b1001'1100 would turn into 0b0011'1001. Rules: Shortest code wi...
Sclipting, (UTF-16) 26 bytes 갠긂갠밂乘감뒄뀢감雙갿및剩 Uses a formula I found here unsigned char b; // reverse this (8-bit) byte b = (b * 0x0202020202ULL & 0x010884422010ULL) % 1023;
I was surprised by your post, as I don't recall any discussions about changing that, and then I wondered how to change that. I looked around in the site-level and category-level settings both here...
On most Codidact communities the posts list has a "Random" button among the sorting buttons: The only exceptions are the Codidact Proposals community, and Code Golf: This suggests that it is ...
Python (3.6 and up), 32 bytes (unsigned integer I/O) lambda x:int(f'{x:08b}'[::-1],2) Input and output are int objects. This also reverses the bits in integers larger than 255, implicitly infer...