Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 39328

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

3 votes

Implement a Truth-Machine

TI-BASIC, 8 bytes There are two programs that achieve 8 bytes: Repeat not(Ans Disp Ans End Repeat is TI-BASIC's do-until loop, so it doesn't check the condition the first time. The other way is recur …
lirtosiast's user avatar
  • 21.5k
5 votes

Implement a Truth-Machine

Befunge-98, 7 bytes &:.:j@# Explanation: & Read integer : Push copy . Print the copy : Push another copy j Jump that many characters to the righ …
lirtosiast's user avatar
  • 21.5k
3 votes

The pirate world's rules of distribution

Pyth, 13 bytes +-100sJ%R2tQJ Test suite.
lirtosiast's user avatar
  • 21.5k
1 vote

Distinct subsets that sum to a given number

Pyth, 8 bytes {fqsTQyE No bonus. { f Unique elements of filter lambda T: q equals s T sum of T Q First input y E over a …
lirtosiast's user avatar
  • 21.5k
16 votes

Shortest code to produce infinite output

Bitxtreme, 0.25 bytes Binary representation: 00 From the documentation: The first bit of each pair is a pointer to the memory position which holds the value to subtract from the accumulator. The res …
lirtosiast's user avatar
  • 21.5k
1 vote

Integer mark into grade

TI-BASIC, 69 68 66 bytes .1Ans sub("F?E-E+D-D+C-C+B-B+A",1+2max(0,min(9,int(2Ans)-11)),int(e^(Ans<10 and Ans≥6 and iPart(2.2-5fPart(Ans TI-BASIC is not good for string manipulation. Input on the c …
lirtosiast's user avatar
  • 21.5k
10 votes

Format the given number of bytes to a human readable format

TI-BASIC, 44 Would be the right tool for the job if TI-BASIC had halfway decent string manipulation (I had to resort to overwriting the exponent of the number, displayed in engineering notation, with …
lirtosiast's user avatar
  • 21.5k
2 votes

Dice adventure in the river Styx

TI-BASIC, 16 20 19 bytes Straightforward. The +8/-1 consensus on meta is that mixing inputs is allowed—so Ans, from command-line input, is the number of faces, and N is the number of throws. Input N …
lirtosiast's user avatar
  • 21.5k
9 votes

Retina or Trash?

TI-BASIC, 43 Takes width and height through the homescreen as a two-element list, and diagonal through Input. Input D If 300D>√(sum(Ans² Then Disp "Retina! Else "Trash! TI-BASIC's two-byte lowerca …
lirtosiast's user avatar
  • 21.5k
8 votes
Accepted

Can I Choose Not to Fly?

TI-BASIC, 84 82 bytes Prompt Str1,Str2,X "GSMAOBT->Str3 {-3,-1,0,1,2,i,-2i Ans(inString(Str3,sub(Str1,1,1))-Ans(inString(Str3,sub(Str2,1,1 X>real(Ans-iAns I store the positions of each city on the …
lirtosiast's user avatar
  • 21.5k
0 votes

Is a number divisible by each of its digits?

TI-BASIC, 29 Adapted from my answer to Generate Monday Numbers. Input X int(10fPart(X10^(-randIntNoRep(1,1+int(log(X not(max(remainder(X,Ans+2Xnot(Ans To disqualify numbers that contain zeroes, I …
lirtosiast's user avatar
  • 21.5k
3 votes

Number of transformations until repeat

Pyth, 10 9 8 bytes tl.u@LN_ Explanation: t One less than l the number of values achieved by .u repeating the following lambda N until already seen value: …
lirtosiast's user avatar
  • 21.5k
1 vote

Number of transformations until repeat

Dyalog APL, 29 28 27 bytes ¯2∘+∘≢{⍵,⍨⊂⌽(⍋⍳⊢)⊃⍵}⍣{⍺≢∪⍺} Takes boxed arrays. Will trainify and explain later. Try it here as a test suite.
lirtosiast's user avatar
  • 21.5k
1 vote

Find the best period in which to have invested in a S&P500 index fund

Jelly, 11 bytes ṡ⁹L¤U×\€UḋM Try it online! The return factor on a deposit is the cumulative product of the return factors in the years until the end of the K year period. If we're allowed to take …
lirtosiast's user avatar
  • 21.5k
0 votes

Swapping heightmaps to depthmaps

APL (Dyalog Extended), 14 bytes {⊖⍉+⌿⍵≥⍀⍳⌈/,⍵} Try it online! {⊖⍉+⌿⍵≥⍀⍳⌈/,⍵} Monadic function: ⍵ Start with a 2D array ⍵. ⌈/, Find the overall maximum value h. …
lirtosiast's user avatar
  • 21.5k

1
2 3 4 5
21
15 30 50 per page