New answers tagged

1

Burlesque, 1000 or 1111111 1e3 1cy7.+ Try it online! First the boring method just printing 1000, or making an infinite number of 1s and clipping it to the length of the code+1.


0

Fortran (GFortran), 24 ones print*,("1",i=1,23) end Try it online! Better Fortran score by avoiding formats entirely.


1

naz, 100,000,000 11,111 1a5o Explanation 1a5o # Output "1" five times I slightly misunderstood the question at first — here's my original 8-byte solution: 1a1o1s8o


0

x86-16, IBM PC DOS, 111,111,111 B8 0A31 MOV AX, 0A31H ; AH = 0AH (write chars * CL), AL = '1' B1 09 MOV CL, 9 ; display 9 times CD 10 INT 10H ; call BIOS C3 RET ; return to DOS This is based on @krubo's answer above, but 3 bytes shorter. This uses the PC BIOS's INT 10,0AH function for output since ...


3

Wolfram Language (Mathematica), 219 188 184 bytes F@A_:=MinimalBy[##&@@@f/@#[[1]]&@*(FindPermutation@A~PermutationProduct~#&)/@GroupElements@PermutationGroup[Cycles@*List/@Join@@((f=Partition[#,2,1]&)/@Values@PositionIndex@A)],Length] Try it online! -31 bytes thanks to @Chris -4 bytes by making the code much faster (no more ...


3

Jelly, 51 43 bytes ṪµṢ,$Ḣ©€E¬a="ʋṚƊ×\ẸÞṪTḢ,®ṛ¦Ẹ}¡@¥ WÇẸпFĖẠƇÄ Try it online! A pair of links which when called as a monad returns a list of pairs of 1-indexed indices to swap. Based on the clever J algorithm developed by @Jonah, so be sure to upvote that one too! Explanation Helper link Takes a list containing a list of the remaining items to be ...


5

J, 126 bytes [:>[:{:"1@}./:~(({.@I.@:~:>@{.)({:@](|.@:{`[`]}~;])[,[:(0{*/,&I.{.)(<0{i.@$)*"1{"0 1=|.@])(,:>@{.))^:(-.@-:>@{.)^:a:;&(0 2$'') Try it online! Here is the same code in a more procedural form, if you're looking for an explanation of algorithm. f=. 3 :0 sorting=.y NB. copy of input we'll mutate sorted=./:~y swaps=.0 2$'' ...


0

Python 2, 137438953472 (2^37) print 2**37 Code is 11 bytes long, output is 12 bytes long.


0

Intcode, 100000000000000000000000000000000 2,7,7,7,4,7,99,10000000000000000 This is almost certainly sub-optimal, given all it does is square the number given at the end.


Top 50 recent answers are included