New answers tagged

1 vote

Divisibility test

Thunno, 2 bytes (Actually \$ 2\log_{256}(96)\approx \$ 1.65 bytes but the leaderboard doesn't take decimals) $! Attempt This Online! Takes \$n\$ then \$d\$. ...
  • 9,266
1 vote

Divisibility test

Trilangle, 7 bytes ??~%!@( Try it on the online interpreter! Outputs '0' for true and a negative number for false, in accordance with how the language's branching ...
  • 1,998
2 votes

Divisibility test

Pyt, 1 byte | Try it online! Trivial built-in. Takes d then n
1 vote

Divisibility test

Desmos, 19 bytes f(n,d)=0^{mod(n,d)} Try it on Desmos!
  • 2,800
1 vote

Divisibility test

Go, 37 bytes func f(n int,d int)bool{return n%d<1} Attempt This Online! Simple solution but requires a pretty big boilerplate around it.
  • 9,266
0 votes

1, 2, Fizz, 4, Buzz

Pick Basic, 209 bytes ...
1 vote

Blinking Lighthouses

Vyxal, AB 37 bytes :ƛ`SL`⟨₀|1110⟩Ŀ\06εJṅÞċ60²Ẏv⌊;∑$Lʀ¨VO The first start may be slow (or time-off) due to the use of the ...
  • 1,023
0 votes

Blinking Lighthouses

Wolfram Language (Mathematica), 119 bytes ...
  • 1,023
0 votes

Raise integer x to power x, without exponentiation built-ins

Fortran (GFortran), 73 bytes integer(selected_int_kind(32))::n read*,n;print*,product([(n,j=1,n)]);end Try it online!. Uses a larger integer type because the ...
  • 2,078
0 votes

Raise integer x to power x, without exponentiation built-ins

Thunno D, \$5\log_{256}(96)\approx\$ 4.12 bytes ZOA*P Attempt This Online! Note: the built-in solution would have been just one ...
  • 9,266
0 votes

Raise integer x to power x, without exponentiation built-ins

awk - a LOT of bytes (123 ?, per Deadcode), but it includes the full recursive binary squaring algorithm tailored for ...
0 votes

Raise integer x to power x, without exponentiation built-ins

Arturo, 16 bytes $=>[∏@.of:<=&] Try it
  • 16.8k
1 vote

Raise integer x to power x, without exponentiation built-ins

C (gcc) with -lgmp, 82 bytes Uses GMP because everyone needs to be able to do 100**100. ...
  • 4,577
0 votes

Raise integer x to power x, without exponentiation built-ins

Aussie++, 94 bytes Not that there's an exponentiation builtin in the first place. ...
  • 1,998
1 vote

Raise integer x to power x, without exponentiation built-ins

ReRegex, 55 bytes #import math (_+)p(_+)_/$1*($1p$2)/p_\b//#input p#input I/O as Unary _'s. Explanation Implements exponentiation by repeating the argument itself ...
  • 9,215
1 vote

Raise integer x to power x, without exponentiation built-ins

FunStack alpha, 14 bytes Product Repeat Try it at Replit! Explanation ...
  • 36.1k
1 vote

Division and remainder

ARBLE, 14 bytes a//b..","..a%b 6 bytes longer than I'd like, but I couldn't find a shorter way to deliminate the two as ...
  • 9,215
1 vote

Division and remainder

Thunno DK, 4 bytes (Actually \$4\log_{256}(96)\approx\$ 3.29 bytes but the leaderboard doesn't take decimals) |X$x Attempt This ...
  • 9,266
1 vote

Division and remainder

Japt, 7 bytes £rYguiz Try it ...
  • 39.6k
0 votes

Hunt for discount

Jelly, 7 bytes ~ỤỤ~ḂHḋ Try it online! Or, more to the point, ỤỤ^LḂḋH. Turns out, there's a ton of 7-byters--and when that's the ...
0 votes

Index and return 3 characters

Alice, 28 bytes !3wi' %.?+!/ O \t.$K?/ O \@ Try it online! The trailing new line is required for the ordinal mode to work. ...
  • 2,308
2 votes

Index and return 3 characters

PowerShell, 53 60 bytes -7 bytes thanks to @Julian By encapsulating the first command in parenthesis, I was able to skip the second command which just printed $t and saved 1 byte. The other 6 bytes ...
1 vote

Index and return 3 characters

JavaScript (Node.js), 51 55 bytes -4 bytes thanks to @xigoi ! For the first time, i got the shortest JS answer! ...
  • 581
1 vote

Blinking Lighthouses

Nibbles, 24 bytes .:0,,$,`?.`'.@<3600^~:+.$.\`,%$9`$$.,6 0+$@ Attempt This Online! This program is a bit complicated. ...
  • 6,363
1 vote

Index and return 3 characters

Java 8 (OpenJDK 8), 75 107 bytes -32 bytes. I don't know why i didn't think sooner of using peek even though it has been invented specifically for this kind of ...
  • 581
2 votes

Index and return 3 characters

J, 32 24 bytes echo,.(,+/)32|3 u:1!:1[3 Full program, -8 bytes thanks to Conor. Attempt This Online! ...
  • 1,100
1 vote

Hunt for discount

Arturo, 35 bytes $=>[/∑map reverse sort&[x,y][y]2] Try it Same method as most of the other answers. Sort, reverse, take every other element, sum, and halve.
  • 16.8k
1 vote

Index and return 3 characters

Fig, \$8\log_{256}(96)\approx\$ 6.585 bytes SM',%32C Try it online! Sorta-port of 05AB1E. ...
  • 5,153
1 vote

Index and return 3 characters

Thunno N, \$ 7 \log_{256}(96) \approx \$ 5.76 bytes O32%DST Attempt This Online! Explanation ...
  • 9,266
3 votes

Index and return 3 characters

Nibbles, 5.5 4.5 bytes ;.@%$32+ Attempt This Online! Shorter than the Vyxal answer not anymore but still doesn't cheat by storing information in flags. Nibbles is ...
  • 6,363
3 votes

Hunt for discount

Nibbles, 6 bytes /+`%~>>\`<_~ Attempt This Online! ...
  • 6,363
1 vote

Summing the Digits of a Number

bc, 35 bytes for(;i<length(a);i++)b+=a/10^i%10;b Try it online! Using the default scale=0 i.e. no decimals, divide by ...
  • 2,078
1 vote

Summing the Digits of a Number

Google Sheets, 44 bytes =QUERY(,"select "&REGEXREPLACE(A1,"\B","+"))
  • 311
1 vote

Summing the Digits of a Number

KamilaLisp v0.2, 15 (APL SBCS) $(⌿.← +)∘:⊙⍫∘⍫∧ Equivalent to $(foldl1 +)@:parse-number@str:explode.
0 votes

Greatest Common Divisor

Zsh, 29 bytes (($1))&&$0 $[$2%$1] $1||<<<$2 Try it online!
  • 2,078
1 vote

Greatest Common Divisor

Thunno, \$ 19 \log_{256}(96) \approx \$ 15.64 bytes ~e1+I$S0=Ez(DMsAh1+ Attempt This Online! Thanks to @Fhuvi for pointing out a bug. Explanation ...
  • 9,266
1 vote

Greatest Common Divisor

Piet + ascii-piet, 42 bytes (2×21=42 codels) qbdijbrlkumldqralckkB jj s??venvfff bb Try Piet online!
  • 2,957
0 votes

Distance between two points in n-dimensional space

Fortran (GFortran), 85 80 bytes function d(A,n);real A(n,2);s=0;do5 i=1,n;s=s+(A(i,1)-A(i,2))**2 5 d=sqrt(s);end Try it online!   85 bytes Instead of two vectors, ...
  • 2,078
1 vote

Greatest Common Divisor

Desmos, 44 bytes f(l)=[i0^{mod(l,i).max}fori=[1...l.max]].max Try it on Desmos! Input is a list of two integers. It won't work if at least one of the inputs is ...
  • 2,800
0 votes

The vanilla factorial challenge

Fortran (GFortran), 51 42 bytes We abuse that variables (and functions) beginning with i,j,k,l,m or n are assumed to be (or return) integers, and that all other objects are assumed to be (or return) ...
  • 793
1 vote

The vanilla factorial challenge

Nibbles, 8 nibbles (4 bytes) ? $ `*,$ 1 Attempt This Online! Explanation ...
  • 151
0 votes

The vanilla factorial challenge

JavaScript, 29 bytes Without recursion Expects Number type Max value is 170. If above outputs ...
  • 1,353
2 votes

The vanilla factorial challenge

Piet + ascii-piet, 24 bytes (4×10=40 codels) rmttlddqbDlbaltdmu?_ V?? Try Piet online! Similar to below, but realized that I can remove ...
  • 69.9k
0 votes

Output a string's cumulative slope

J, 12 bytes 1#.2-~/\3&u: Attempt This Online! ...
  • 1,100
0 votes

Output a string's cumulative slope

JavaScript, 36 bytes s=>s.at(-1)[x='charCodeAt']()-s[x]() Try it: ...
  • 1,353
1 vote

Output a string's cumulative slope

Thunno, \$4\log_{256}(96)\approx\$ 3.29 bytes Oz[S Attempt This Online! Takes the challenge literally, as that's the shortest way. ...
  • 9,266
0 votes

Summing the Digits of a Number

Pascal, 114 bytes This is a full program according to ISO standard 7185 “Standard Pascal”. The built-in data type integer ...
1 vote

Summing the Digits of a Number

Groovy, 37 bytes def c={("$it"as List).sum{it as int}} Try it online!
0 votes

Summing the Digits of a Number

CJam, 5 bytes s:~:+ Try it online! Link includes test cases. A function taking an integer as input. Essentially a direct port of my GolfScript Answer. Explanation <...
  • 757
2 votes

Summing the Digits of a Number

Julia, 12 10 bytes Tacit Julia strikes again! sum∘digits Explanation: ...

Top 50 recent answers are included