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 ...
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 ...
7
votes
Which skill to train?
APL(Dyalog Unicode), 14 bytes SBCS
⊃∘⍒(1+÷)*1+⍋∘⍋
Try it on APLgolf!
...
5
votes
Sine using square root
Vyxal, 39 bitsv2, 4.875 bytes
∆R∆sS
Try it Online!
Bitstring:
000100111011111001011001001010111111101
Outputs square root as <...
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)....
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 0° to ...
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 ...
4
votes
Which skill to train?
Vyxal 3, 11 bytes
∥ϩėꜝ↑↑2+*ƓḞ
Try it Online!
Port of l'apl
Explained
...
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.
4
votes
Which skill to train?
05AB1E, 14 bytes
āΣIāyQ+{ā>mP}θ
1-based.
Try it online or verify all test cases.
Explanation:
...
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 ...
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 "...
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.
...
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 ...
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 - #...
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 ...
3
votes
Which skill to train?
Uiua, 13 bytes
⊢⍖ⁿ+2⍏⍏:+1÷,1
Try it!
0-indexed. Port of lyxal's Vyxal 3 answer.
...
2
votes
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!
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!
...
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.
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υ
...
2
votes
Produce the shortest suffix for an (almost) arbitrary string
Python, 147 bytes
-7 bytes, thanks to STerliakov
...
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
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.
...
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 ...
1
vote
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 ...
1
vote
Finding the power sandwich
MATL, 14 bytes
w1Y\^tkwXkh1G^
Try on MATL Online or
Test all cases
...
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
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
math × 1771code-golf × 1596
number × 295
sequence × 229
arithmetic × 183
number-theory × 171
geometry × 121
integer × 93
primes × 87
combinatorics × 86
decision-problem × 83
code-challenge × 74
array × 74
matrix × 70
polynomials × 60
string × 58
rational-numbers × 53
fastest-code × 50
abstract-algebra × 40
ascii-art × 38
base-conversion × 37
linear-algebra × 34
open-ended-function × 30
fibonacci × 29
restricted-source × 28