11
votes
9
votes
ASCII-Art n'th Root
Python, 143 bytes
def f(a,b):
A=len(str(-a))&-2;print(A*" ",len(str(b))*"_"+f"\n{a:<{A}}/{b} = {b**(1/a):.{A}}");p="\\"
while A:A-=2;print(p+A*" &...
8
votes
Palindromic Powers
05AB1E, 11 bytes
<TŸʒÓ¿≠yÂQ&
Try it online!
Before Kevin wakes up and outgolfs me. Port of Jelly.
How?
...
8
votes
There's more than one way to skin a set
BQN, 15 bytesSBCS
(1=⊒)⊸/·⥊(∾∾+)˝
Run online!
BQN, 19 bytesSBCS
(1=⊒)⊸/<+´∘ר⟜⥊⟜↕2¨
Run online!
...
7
votes
Rounding a range
Python, 44 bytes
lambda a,b:(m:=(a+b+1-(l:=int(b-a)))//2,m+l)
Attempt This Online!
Old Python, 50 bytes
lambda a,b:(m:=(a+b+~(l:=int(b-a))%2)//2-l//2,m+l)
Attempt This Online!
Old Python, 56 bytes
...
7
votes
There's more than one way to skin a set
Wolfram Language (Mathematica), 34 bytes
##2&@@@Gather[Tr/@Subsets@#]⋃{}&
Try it online!
...
6
votes
ASCII-Art n'th Root
JavaScript (ES8), 158 156 bytes
Expects (a)(b), where both arguments are strings.
...
6
votes
6
votes
ASCII-Art n'th Root
Charcoal, 37 bytes
θ⸿↘⊘⊕Lθ↑↗⊘⁺³Lθ⟦⭆η_⟧η = ﹪⁺⁺%.LθfXIη∕¹N
Try it online! Link is to verbose version of code. Explanation:
θ
...
6
votes
Palindromic Powers
Jelly, 13 bytes
’⁵rŒḂƇÆEg/’ƊƇ
Try it online!
-1 byte thanks to Jonathan Allan!
In order for some \$k = p_1^{e_1}p_2^{e_2}\cdots p_i^{e_i}\$ to be a perfect power (...
5
votes
Print 0 to 100 without 1-9 characters
Vyxal jHRM, 0 bytes
Try it Online!
Kinda cheating, but whatever.
How?
...
5
votes
Sequence of integers not the sum of powers of earlier terms
Python 3, 121 107 105 102 101 bytes
-3 inspired by Neil's comments, and another -1 thanks to Neil!
Prints the sequence indefinitely. Runs out of memory before finding 25 on TIO.
...
5
votes
5
votes
5
votes
There's more than one way to skin a set
Vyxal, 8 bytes
ṗṠsĠ~Ḣvh
Try it online or run all test cases.
sĠ~Ḣvh is the shortest way I can think of to keep only duplicates, ...
5
votes
There's more than one way to skin a set
R, 66 bytes
\(S,t=table(unlist(Map(\(i)combn(S,i,sum),seq(!S)))))names(t[t>1])
Attempt This Online!
4
votes
Output the sign
Piet + ascii-piet, 19 bytes (4×6=24 codels)
tabraF krbtKbks?Tbb
Try Piet online!
(previous record: 40 codels/ascii-piet bytes)
An approach involving a CC+ turned ...
4
votes
ASCII-Art n'th Root
Python, 169 bytes
def f(a,b):print(" "*((A:=len(str(a)))-1+(x:=A%2)),"","_"*len(str(b))+f"\n{a}{x*' '}/{b} =",round(b**1/a,A),*("\n"+i*" &...
4
votes
4
votes
Palindromic Powers
Wolfram Language (Mathematica), 60 bytes
Select[h=Range[#-1],(h[[a#]]=a=h[[#]])<#>9&&PalindromeQ@#&]&
Try it online!
...
4
votes
4
votes
There's more than one way to skin a set
JavaScript (V8), 69 bytes
a=>(g=([v,...a],s=0)=>v?g(a,s+v)|g(a,s):(g[s]=-~g[s])-2||print(s))(a)
Try it online!
Commented
...
4
votes
There's more than one way to skin a set
J, 28 19 bytes
[:~.@(#~1-~:)(,,+)/
Try it online!
-9 thanks to ovs for the (,,+)/ trick for calculating all subset sums!
...
3
votes
Sort by Multiplying
TI-Basic, 43 40 37 bytes
Prompt A
For(I,1,dim(ʟA
ʟA(I)(1+int(Ans/ʟA(I→ʟA(I
End
ʟA
-6 bytes thanks to MarcMush.
3
votes
Music with pi and e
Vyxal, 29 bytes
ƛkAf7Ẏ2Ǔ:3Ẏ\'vJJn∆iin∆i›∆ė4/"
Try it Online! or Run both test cases!
Port of 05AB1E. If it can't output rationals instead of decimals, add <...
3
votes
Print 0 to 100 without 1-9 characters
Desmos, 25 bytes
o=0
o->[0...eeeln(eeeee)]
Not sure if this is an acceptable form of output but it's still an interesting answer imo. Click the right arrow (<...
3
votes
Sequence of integers not the sum of powers of earlier terms
Jelly, 24 22 bytes
*þṀŻ$ZŒpŒP€Ẏ§‘ḟ$Ṃ;
⁸Ç¡
Try it online!
Takes \$n\$ via STDIN and outputs the first \$n\$ terms in reverse order. +1 byte if the output has to be ...
3
votes
Sequence of integers not the sum of powers of earlier terms
Jelly, 22 bytes
-rṀṗL‘a*@ɗ⁸§‘ḟ$Ṃ;@
⁸Ç¡
A full program that accepts an integer, n, from STDIN and prints the Jelly ...
3
votes
Rounding a range
Factor + math.unicode, 44 bytes
[ 2dup - ⌊ -rot 1 + + over - 2 /i tuck + ]
Try it online!
Takes input as ...
3
votes
Rounding a range
05AB1E, 16 14 bytes
O>I`αï©-2÷D®+‚
-2 bytes porting @loopyWalt's Python answer; make sure to upvote him as well!
Try it online or verify all test cases.
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
number × 1211code-golf × 1124
math × 279
sequence × 229
arithmetic × 140
integer × 109
string × 94
number-theory × 94
decision-problem × 92
array × 80
primes × 61
base-conversion × 51
code-challenge × 44
ascii-art × 34
binary × 34
kolmogorov-complexity × 31
combinatorics × 26
random × 22
fibonacci × 21
restricted-source × 20
matrix × 20
sorting × 18
permutations × 18
rational-numbers × 18
fastest-code × 16