Posts by snail_
Ruby, 8 bytes ->n{n%2} Generic mod-in-a-lambda solution. Alternately, for 2.7+: ->{_1%2} Try it online!
Ruby, 36 bytes ->a{i=-1;a.map{a[0..i+=1].count _1}} Try it online! The code in the TIO link is 2 bytes longer because _n block parameter names are not supported on TIO's Ruby instance yet. ...
Ruby, 53 bytes ->n{n-=3;[?╔+?╦*n+?╗,*[?╠+?╬*n+?╣]*(n+1),?╚+?╩*n+?╝]} Try it online!
Ruby, 11 bytes ->n{"%b"%n} Simple string formatting. Try it online!
Ruby, 51 50 bytes -1 from Razetime ->p,n{while i=p.find{(_1*n).to_f%1==0} n*=i end n} Try it online!
BQN, 13 bytes {+´(𝕨⋆↕≠𝕩)×𝕩} { } # fn +´ # sum reduce (𝕨⋆↕≠𝕩) # x^i for each term ×𝕩 # times each coefficient Try it
- ← Previous
- 1
- 2
- Next →