Hot answers tagged

15 votes

Sine using square root

Python, 89 bytes c='s-1*' y='/s+2/s++7s5s*6+5s522' f=lambda d:d and'+*'+y+(x:=f(d-3))+'*'+c+x*2+c+y*2or'0' Attempt This Online! It times out when trying to run it ...
97.100.97.109's user avatar
13 votes

Sine using square root

Python 3, 75 bytes lambda x:f"(1-1{(s:=x//3*'*(1+S(5)+S(S(20)-10))/(S(12)+S(-4))')})/S(-4{s})" Try it online! This produces an expression with complex ...
xnor's user avatar
  • 144k
7 votes

Which skill to train?

APL(Dyalog Unicode), 14 bytes SBCS ⊃∘⍒(1+÷)*1+⍋∘⍋ Try it on APLgolf! ...
att's user avatar
  • 19.7k
5 votes

Sine using square root

Vyxal, 39 bitsv2, 4.875 bytes ∆R∆sS Try it Online! Bitstring: 000100111011111001011001001010111111101 Outputs square root as <...
lyxal's user avatar
  • 32.6k
5 votes

Which skill to train?

Jelly, 9 8 bytes ‘÷*ỤỤ‘ƊM Try it online! A monadic link taking a list of five integers and returning the index of the skill to improve (wrapped in a length 1 list)....
Nick Kennedy's user avatar
  • 18.9k
4 votes

Sine using square root

Python 3 + SymPy, 41 39 bytes lambda n:sin(rad(n)) from sympy import* Try it online! Link outputs all results from to ...
Neil's user avatar
  • 165k
4 votes

Sine using square root

Ruby, 132 110 bytes f=->x{(x%60-24).abs==6?%w{(s5-1)/4 1/2 (s(30+s180)+s5-1)/8 1}[x/30]:"s(1/2+#{q=x<=>45}*(#{f[q*(x*2-90)]})/2)"} Try it ...
Level River St's user avatar
4 votes

Which skill to train?

Vyxal 3, 11 bytes ∥ϩėꜝ↑↑2+*ƓḞ Try it Online! Port of l'apl Explained ...
lyxal's user avatar
  • 32.6k
4 votes

Which skill to train?

Python, 69 bytes lambda s:s.index(max(s,key=lambda t:(~t/-t)**sum(map(t.__ge__,s),1))) Attempt This Online! 0-based.
Albert.Lang's user avatar
  • 2,229
4 votes

Which skill to train?

05AB1E, 14 bytes āΣIāyQ+{ā>mP}θ 1-based. Try it online or verify all test cases. Explanation: ...
Kevin Cruijssen's user avatar
4 votes

Which skill to train?

R, 35 bytes \(x,`-`=order)(-(1+1/x)^(--x+1))[5] Attempt This Online! An anonymous function taking an integer vector and returning an integer. Uses the same method ...
Nick Kennedy's user avatar
  • 18.9k
3 votes

Alternating sums of multidimensional arrays

Uiua, 9 bytes ⍥(/-⇌)⧻△. Try it online! Similarly to BQN and K, alternating sum in Uiua requires a reverse before reduction by subtraction. Uiua doesn't have "...
Bubbler's user avatar
  • 73.8k
3 votes

Finding the power sandwich version 2

C (gcc), 98 bytes -1 thanks to ceilingcat Adapted from my JS answer. Prints the bounds separated by a space. ...
Arnauld's user avatar
  • 188k
3 votes

Finding the power sandwich version 2

05AB1E, 16 14 bytes LÂZ+‚εR.ΔÓ0š¿≠ -2 bytes porting @JonathanAllan's Jelly answer instead. Try it online or verify all test cases. (Times out for the largest two ...
Kevin Cruijssen's user avatar
3 votes

Sine using square root

Mathematica/Wolfram, 27 bytes f=FunctionExpand@Sin[#*°]& Try it online (thx to @noodle man) This is a function solution - #...
Martin Modrák's user avatar
3 votes

Which skill to train?

Nekomata, 12 bytes çᵚᶠ≥Mŗ→ᵐ∏x$Ṃ Attempt This Online! Based on @att's APL answer, with some hacks because Nekomata doesn't have built-ins for ranking, grade-up, or ...
alephalpha's user avatar
  • 46.5k
3 votes

Which skill to train?

Uiua, 13 bytes ⊢⍖ⁿ+2⍏⍏:+1÷,1 Try it! 0-indexed. Port of lyxal's Vyxal 3 answer. ...
chunes's user avatar
  • 22.7k
2 votes

Find the submatrix with the smallest mean

Uiua, 14 bytes ÷9/↧♭⍥(/+⍉◫3)2 Try it! ...
Bubbler's user avatar
  • 73.8k
2 votes

Multiplicative persistence

Go, 87 bytes import."fmt" func f(n int){Println(n) s:=1 if n<10{return} for;n>0;n/=10{s*=n%10} f(s)} Attempt This Online!
bigyihsuan's user avatar
  • 8,528
2 votes

Finding the power sandwich version 2

Scala, 149 bytes A port of @Giuseppe's R answer in Scala. Golfed version. Try it online! ...
138 Aspen's user avatar
  • 4,755
2 votes

Alternating sums of multidimensional arrays

J, 7 5 bytes -/^:_ Try it online! -2 thanks to Bubbler Just a J translation of the APL answer, for completeness.
Jonah's user avatar
  • 33k
2 votes

Produce the shortest suffix for an (almost) arbitrary string

Charcoal, 38 bytes ⊞υωFυ¿¬ⅈ¿﹪ΣE⁺θι×⊕λ℅κφFΣ⟦αβ⭆χκ._⟧⊞υ⁺ικι Try it online! Link is to verbose version of code. Explanation: ⊞υωFυ ...
Neil's user avatar
  • 165k
2 votes

Produce the shortest suffix for an (almost) arbitrary string

Python, 147 bytes -7 bytes, thanks to STerliakov ...
bsoelch's user avatar
  • 5,677
2 votes

Which skill to train?

JavaScript (Node.js), 67 bytes x=>x.map((t,i)=>[(t/++t)**x.filter(v=>v<t).push(0),i]).sort()[0][1] Try it online! 0-index
l4m2's user avatar
  • 20.3k
2 votes

Which skill to train?

Charcoal, 19 bytes I⊟⌈Eθ⟦X∕⊕ιι⊕№÷θ⊕ι⁰κ Try it online! Link is to verbose version of code. 0-indexed. Explanation: Port of @l4m2's JavaScript answer. ...
Neil's user avatar
  • 165k
1 vote

Finding the power sandwich version 2

APL+WIN, 63 bytes Prompts for integer: (↑(n=⌊/n←|m-i)/m←(⌊i*÷p)*p),↑(n=⌊/n←|m-i)/m←(⌈(i←⎕)*÷p)*p←1↓⍳30 Increase the 30 at the end of the code to handle higher ...
Graham's user avatar
  • 5,436
1 vote

Is this a triangle?

Noulith, 26 bytes \a,b,c->2*max(a,b,c)<a+b+c Try it online!
bigyihsuan's user avatar
  • 8,528
1 vote

Finding the power sandwich

Vyxal 3, 7 bytes ė*∦⌊⌈$* Try it Online! Takes two integers as its argument and returns two integers. Works the same as various other answers including @mathscat’s ...
Nick Kennedy's user avatar
  • 18.9k
1 vote

Finding the power sandwich

MATL, 14 bytes w1Y\^tkwXkh1G^ Try on MATL Online or Test all cases ...
Sundar R's user avatar
  • 6,612
1 vote

Finding the power sandwich

APL+ WIN, 18 bytes Prompts for power and integer: ((⌊p),⌈p←⎕*÷n)*n←⎕ Try it online! Thanks to Dyalog Classic
Graham's user avatar
  • 5,436

Only top scored, non community-wiki answers of a minimum length are eligible