Skip to main content
154 votes

Write Moby Dick, approximately

///, 2*1 + 1020874 = 1020876 Prints a space.
daniero's user avatar
  • 18.6k
110 votes

Write Moby Dick, approximately

Perl, 2·70525 + 326508 = 467558 Predictor ...
A. Rex's user avatar
  • 2,599
103 votes

Write Moby Dick, approximately

Node.js, 2*224 + 524279 = 524727 Please refer to the change log at the end of this post for score updates. A function taking and returning a byte. ...
Arnauld's user avatar
  • 193k
79 votes

Write Moby Dick, approximately

Python 3, 2·267 + 510193 = 510727 Predictor ...
Anders Kaseorg's user avatar
57 votes

Write Moby Dick, approximately

Python 3, 2*279+592920=593478 2*250 + 592467 = 592967 2 * 271 + 592084 = 592626 2 * 278 + 592059 = 592615 2 * 285 + 586660 = 587230 2 * 320 + 585161 = 585801 2 * 339 + 585050 = 585728 ...
Michael Homer's user avatar
25 votes

Write Moby Dick, approximately

C++, score: 2*132 + 865821 = 866085 Thanks to @Quentin for saving 217 bytes! ...
Steadybox's user avatar
  • 16.5k
22 votes

Write Moby Dick, approximately

Python, 2*516 + 521122 = 522154 Algorithm: Yet another python submission, this algorithm calculates the most likely next letter looking at sequences of length 1,...,l. The sum of probabilities is ...
user2699's user avatar
  • 648
21 votes

Hunt for discount

Python 3, 33 bytes lambda a:sum(sorted(a)[-2::-2])/2 Try it online! This is my first answer :D
Basto's user avatar
  • 553
20 votes

Write Moby Dick, approximately

C++, 2·62829 + 318786 = 444444 To run this program, you need this file here, which must be named C. The program uses the same combination of Markov models as in ...
A. Rex's user avatar
  • 2,599
20 votes

Make me a minimum magic sum

Python 2, 44 bytes a,b,c,d=sorted(input()) print min(c-a,d-b)*2 Try it online! Sorts the input as a,b,c,d, in ascending ...
xnor's user avatar
  • 145k
18 votes
Accepted

Shortest 2-Player Game of Halma

The shortest game of halma is 49 moves 49 move solution Proof there is no 48-move solution Code used for this solution The code now supports pass Notice that the 47 move solution in the paper is ...
Ton Hospel's user avatar
  • 14.9k
18 votes

Island Golf #1: Circumnavigation

Mathematica (version 9), 165 bytes The nice, short ConvexHullMesh function that Greg Martin used was only introduced in Mathematica version 10, so I thought I'd ...
Not a tree's user avatar
  • 3,206
18 votes

Plight of the Concorde

88 Cities, 341 seconds runtime on NEOS In a recent paper we constructed a family of hard to solve euclidean TSP instances. You can download the instances from this family as well as code for ...
Stefan Hougardy's user avatar
17 votes

Given a list of circles, output the area of the smallest containing rectangle

Python 2 + PySCIPOpt, 267 bytes ...
Anders Kaseorg's user avatar
16 votes

Find the maximum deviation

Dyalog APL, 7 bytes ⌈/⌈/-⌊/ Test it on TryAPL. How it works ...
Dennis's user avatar
  • 210k
16 votes

Write Moby Dick, approximately

sh+bzip2, 2*364106 = 728212 2*381249 + 0 = 762498 dd if=$0 bs=1 skip=49|bunzip2&exec cat>/dev/null followed by the bzip2-compressed whale2.txt with the ...
Joshua's user avatar
  • 3,454
15 votes

Piet (Mondrian)'s Puzzle

Piet, 9625 (It finally works!) The people demanded it, so here it is. This is an extremely naive solution (essentially the same as the loose upper bounds on the OEIS page): it divides each square ...
Tim Pederick's user avatar
  • 1,721
14 votes

Can a neural network recognize primes?

Trial division: score 59407, 6243 layers, 16478 neurons in total Given as a Python program which generates and validates the net. See the comments in trial_division...
Peter Taylor's user avatar
  • 43.1k
14 votes
Accepted

Make me a minimum magic sum

Jelly, 6 bytes ṢŒœIṂḤ Try it online! A port of my Python answer. ...
xnor's user avatar
  • 145k
14 votes

Permutations in Disguise

Python 2, 60 bytes def f(l):z=zip(l,range(len(l)));print map(sorted(z).index,z) Try it online! Uses zero-indexing. A fast algorithm with a simple idea. If we ...
xnor's user avatar
  • 145k
14 votes

Sort with a neural network

Octave, 96 88 87 84 76 54 50 weights & biases This 6-layer neural net is essentially a 3-step sorting network built from a very simple min/...
flawr's user avatar
  • 43.8k
13 votes

Find a maximal rectangle of 1s

Jelly, 21 20 18 17 bytes ṡṂ€€×" ‘×¥\ç"Ụ€FṀ Try it online! or verify all test cases. Background Let M be a matrix of bits such as ...
Dennis's user avatar
  • 210k
13 votes
Accepted

Choose the last card in a poker hand

Pyth, 73 bytes eo_S+*-5l@\AN}SPMJ+NZSM.:+\AT5+-4l{eMJlM.gPkJ-sM*=T+`M}2Tc4"JQKA""hscd"=Zc This is pretty terrible. Parsing cards, sorting the values, ... ...
Jakube's user avatar
  • 21.9k
13 votes

Write Moby Dick, approximately

Python 3, 879766 F=[[0]*123for _ in range(123)] P=32 def f(C):global P;C=ord(C);F[P][C]+=1;P=C;return chr(max(enumerate(F[C]),key=lambda x:x[1])[0]) Try it ...
DELETE_ME's user avatar
  • 17.3k
13 votes

Write Moby Dick, approximately

C#, 378*2 + 569279 = 570035 ...
Charlie's user avatar
  • 12.9k
12 votes

Who Is Kevin Bacon?

BQN*, 53 45 bytesSBCS {1+⊑⍒+˝+´(∨∨∨˝∘×⎉1‿∞)⍟n˜∨⟜⍉∨˝𝕩≡⌜1+⋈⌜˜n←↕⌈´∾𝕩} Run online! Theory: Let \$k\$ be the maximum node id. Then the node IDs are \$\{1, 2, ..., k\}...
ovs's user avatar
  • 59.5k
11 votes

Island Golf #1: Circumnavigation

(But go upvote Notatree's solution, it's better!) Mathematica, 168 bytes ...
Greg Martin's user avatar
  • 15.8k
11 votes

How small can it get?

Haskell, 67 61 bytes f n=minimum$n:[f$div n d|d<-read.pure<$>show n,d>1,mod n d<1] Try it online! Explanation: ...
Laikoni's user avatar
  • 26.2k
11 votes

How small can it get?

Jelly, 8 bytes ÷DfḶ߀Ṃo Try it online! Alternate version, much faster, 9 bytes ÷DfÆḌ߀Ṃo Try it online! How it works <...
Dennis's user avatar
  • 210k

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