Hot answers tagged

26 votes

American odds to probabilities

Python, 25 bytes lambda x:x/(~99-abs(x))%1 Attempt This Online! Thanks @Jonathan Allan for -1. Original Python, 26 bytes ...
loopy walt's user avatar
18 votes

Vanilla Natural Logarithm Challenge

Excel, 19 16 bytes With many thanks to Dominic van Essen for the 3-byte save: =1E9*(A1^1E-9-1) Previous: =9^9*(A1^(1/9^9)-1) ...
Jos Woolley's user avatar
  • 1,927
16 votes

Compute the Kolakoski sequence

Python 2, 42 bytes x=y=-1 while 1:x=x/2^y;y<<=x%2;print x%2+1 Try it online! Full disclosure - I didn't find the solution myself. I let my brute forcer do ...
j4at's user avatar
  • 761
14 votes

Add two real numbers ... probably

Python, 75 bytes def f(*I,n=0): for a,b in zip(*I):yield from[a,*n*[1^a]][:-(n:=1+n*(a^b))] Attempt This Online! Takes two iterables and returns one. How? Count ...
loopy walt's user avatar
14 votes

Print a meter of numbers to a specified limit

Canvas, 4 bytes R↶ * Try it online. Explanation: ...
Kevin Cruijssen's user avatar
13 votes

Shortest digid-app GetPercentageRounds function

JavaScript (Node.js), 53 bytes f=(n,i=10)=>i?f(n,--i)+(n>=0&n<=i/10?"⚪":"🔵"):'' Try it online! Need ...
l4m2's user avatar
  • 20.3k
12 votes
Accepted

Sum every second digit in a number

Vyxal, 2 bytes y∑ well. Try it Online! | 1 byte with s Explanation ...
math scat's user avatar
  • 8,467
12 votes

Shortest digid-app GetPercentageRounds function

Scratch, 172 166 142 bytes This program outputs to a global variable o which is automatically displayed and assumes that the i ...
noodle man's user avatar
  • 5,212
12 votes

Vanilla Natural Logarithm Challenge

Builtins These answers are in alphabetical order based on programming language. If your answer is identical to an existing one, please combine them. 05AB1E, 4 bytes ...
12 votes

Output the smallest increasing sequence where each term is coprime to preceding 3 terms

Python 3, 78 77 bytes -1 byte thanks to @Bubbler! Prints the 0-indexed n-th term of the sequence. Who needs gcd anyway? ...
dingledooper's user avatar
  • 22.3k
12 votes

American odds to probabilities

Jelly, 7 bytes ,³ṢAÄ÷/ Try it online! Function I/O only because lmao ³. (Replace with ȷ2 if ...
Unrelated String's user avatar
12 votes

Diagonal Binary Sequence

Python, 39 bytes lambda n,k:n^-2&(1^1<<k)<<len(bin(n))-3 Attempt This Online! Explanation ...
bsoelch's user avatar
  • 5,677
11 votes

Is this number a prime?

Regex (.NET), 604 517 499 469 455 bytes ...
Deadcode's user avatar
  • 11.5k
11 votes

Summing the Digits of a Number

Trilangle, 15 bytes '0.<"@(+>i(^-<! Test it on the online interpreter! Roughly equivalent to this C code: ...
Bbrk24's user avatar
  • 2,735
11 votes

Vanilla Natural Logarithm Challenge

><> (Fish), 71 bytes Trying to solve this in ><> was the original inspiration for this challenge. Posting this now instead of waiting the usual 24 hours to hopefully inspire more ...
mousetail's user avatar
  • 11.8k
11 votes

Half even rounding

Builtins in various languages 05AB1E (legacy), 1 byte ò Only works in the legacy version of 05AB1E, which is builtin in Python. The new version of 05AB1E, which is ...
11 votes

Half even rounding

JavaScript (ES6), 30 bytes Uses the Math.round() built-in, then clears the least significant bit of the result if the squared fractional part of the original input ...
Arnauld's user avatar
  • 188k
10 votes

Gödel encoding - Part I

Jelly,  11 10 9  8 bytes -1 thanks to Unrelated String! (Use of a dyadic chain in place of a monadic compound link avoiding the need for argument manipulation with `...
Jonathan Allan's user avatar
10 votes

Vanilla Natural Logarithm Challenge

Hexagony, 161 122 bytes ...
CursorCoercer's user avatar
10 votes
Accepted

Add two really big numbers

Trivial Built-in Answers For languages where bignum addition is already supported. 05AB1E, Brachylog, Factor, J, Jelly, Julia, Nekomata, RProgN 2, Vyxal, 1 byte + ...
9 votes

Sum every second digit in a number

Python 3, 28 37 32 30 35 bytes lambda n:sum(map(int,str(n)[1::2])) Assuming input is a string number
Neel Shukla's user avatar
9 votes

Calculate my income tax

JavaScript (ES6), 99 bytes Works with floats and rounds the final result. ...
Arnauld's user avatar
  • 188k
9 votes

Round to nicer numbers

Wolfram Language (Mathematica), 18 bytes Round[2^#2#,2^#3]& Try it online! Returns a binary fraction. By default, the built-in ...
att's user avatar
  • 19.7k
9 votes

Shortest digid-app GetPercentageRounds function

Type System (TypeScript 4.9.4) - 243 188 Bytes Now they can validate their function with type safety! 56 Bytes thanks to @ASCII-only 8 Bytes thanks to @ASCII-only 114 Bytes only by @ASCII-only (...
Asleepace's user avatar
  • 605
9 votes
Accepted

Sum of Consecutive Squares

Jelly, 5 bytes Ẇḋ`ṫċ Try it online! ...
Mr. Xcoder's user avatar
  • 42.3k
9 votes

Print all pandigital numbers

x86-64 machine code, 28 bytes 31 C0 FF C0 50 31 C9 99 F7 FE 0F AB D1 01 C2 75 F6 58 FF C1 0F A3 F1 19 D7 73 E7 C3 Try it online! Following the standard calling ...
m90's user avatar
  • 9,771
9 votes

Summing the Digits of a Number

C (gcc), 30 bytes f(int*s){s=*s?*s-48+f(s+1):0;} Try it online! C (clang), 31 bytes f(*s){return*s?*s-48+f(s+1):0;} Try it ...
c--'s user avatar
  • 2,423
9 votes

Largest Binary Area

JavaScript (V8), 67 bytes Prints the sequence infinitely. for(m=n=0;g=k=>k?!(k&k+1)+g(k>>1):s;print(m=m>s?m:s))s=n&++n?g(n):1 Try it online! ...
Arnauld's user avatar
  • 188k
9 votes

Zahlen auf Deutsch! (Numbers in German)

JavaScript (ES6), 213 bytes ...
Arnauld's user avatar
  • 188k
9 votes

The number of solutions to Hertzsprung's Problem

Nekomata + -n, 6 bytes r↕∆A1> Attempt This Online! Brute force. Slow for large input. ...
alephalpha's user avatar
  • 46.5k

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