New answers tagged

0

Perl 5 - (10-10) = 0 bytes print;redo Requires the -ne flags. Takes in a character(s) from STDIN, repeats the character(s) infinitely. Example execution perl -ne 'print;redo' Explanation This takes advantage of the -n flag in Perl, where it explicitly wraps while (<>) { ... } around the source code. The use of redo without an explicit label is ...


0

Ruby, 0 +/-, 0 tie-breakers, 39 bytes And fairly unreadable. p"#{"%#{"%ss%%%ss"%$F}"%%w[o o]}"::size Try it online!


0

Python 3 from numpy import e,log i=lambda:e**int(input());print(int(log(i()*i())))


0

Octave/MATLAB, 37 bytes f=@()e^(input(''));disp(log(f()*f()))


0

Python 3, 25 bytes while 1:print(chr(11*11)) Try it online!


0

MathGolf, 8 bytes -10 = -2 ╜É'x)Äo∟ Try it online! Explanation ╜É else without if (executes block of 3 chars if input is empty) 'x) increment "x" to get "y" Ä start block of length 1 o print TOS without popping ∟ do while true without popping Quite straightforward, but gets the job done.


0

C++, () only for main #include <iostream> int main() { unsigned int a, b; std::cin >> a; std::cin >> b; unsigned int p = a ^ b; unsigned int g = a & b; unsigned int gg {g | p & g << 1}; unsigned int pp {p & p << 1}; unsigned int ggg {gg | pp & gg << 2}; unsigned int ...


0

Ahead, 6 bytes ~Wy'N~ Try it online!


0

Zsh, 26 bytes, 7 tiebreakers Positional parameters are pretty punishing x=({1..$1} {1..$2}) <<<$#x Try it online! 62 bytes, 0 tiebreakers read a b {repeat $a;printf x;repeat $b;printf x}|read x <<<$#x Try it online!


0

Ruby -na0, no +/-, no tiebreakers, 60 bytes $F<<?a until~%r[ ]&&$F::join[%r[a{#$`}a{#$'}]] p$F::count ?a Try it online! Actually harder than I thought, I'm almost certainly missing a trick. Reads in the input, then adds a characters to the argument array until the array, when joined into a string, matches a regular expression that uses the ...


0

Seed, 3865 bytes 5 ...


0

Befunge-98 (PyFunge), 0 +/- characters, 0 tiebreaker characters, 47 bytes brqzzzzzzzzzzzzzzzzzzzpyadgyacpyappyacybyabybay Try it online! Made all out letters, because why not? More readable variant that does pretty much the same thing: b<@ &&pyapyabybay Abuses the y GetSysInfo command, which can be used to ...


0

05AB1E, 4 bytes, 0 +/- `F>} Try it online! Apologies if I misunderstood this challenge, but I was surprised there was no 05AB1E answer. Shortest answer in this language I could come up with that doesn't use + or the built in sum function. Explanation: ` #Push input list onto stack F } #Loop A many times > #Increment B #(Implicit output)...


3

Seed, 3904 3846 11 bytes, 0 +/-, 10 tie breakers 4 141745954


0

MathGolf, 3 bytes, 0 +/- α▓∞ Try it online! While perhaps violating the spirit of the "no sum" rule, this solution wraps the inputs into an array, calculates the average of the values in that array, and duplicates the result. Of course, the avg operator uses a sum internally, but its behavior is inherently different compared to the sum operator Σ. The ...


0

Befunge-98 (FBBI), 4 bytes, one +. &&+. Try it online!


1

PowerShell, 27 42 bytes, 0 +-, 4 1 secondary Thanks to mazzy for saving a + and 4 secondaries $args|%{[int[]]$_*$_}|measure|select count Try it online! or Pretty Table for an extra 3 bytes -Or- adding four secondaries to save 19 bytes: 32 23 bytes, 1 0 +-, 12 5 secondaries -9 bytes thanks to mazzy ($args|%{,$_*$_}).count Try it online! For each ...


1

Keg (SBCS on Keg wiki) Basically a port of the R answer. ¿¿Ï_"Ï_!. Explanation ¿¿# Take 2 integer inputs Ï_"Ï_# Generate 2 arrays the length of the integer inputs !.# Output the length of the stack


0

Brain-Flak, 28 bytes (((((()()()()){}){}){}){}()) Try it online! code: (((((()()()()){}){}){}){}()) push 65 implicitly print stack


0

Brian & Chuck, 7 bytes B? !<-. Try it online! code: Brian: B constant B ? switch to Chuck Chuck: < go to B - decrement it . and print it


0

Runic Enchantments, 6 bytes 'Bl-k@ Try it online! "length of stack" acts as a placeholder for the value 1. 'Lb-k@ and 'C2-k@ both also work and are the same number of bytes.


0

Japt, 5 bytes ¯ÒUÊz Try it here


0

Runic Enchantments, 94 bytes mmXm-m-FFm-k$Xm+mm,+:m-:k$Fm+k::}$$::,:++k:}$mKymmmm+++k$mmqnmm,-k${${:FFm+k$k$Fmm+Xk$FFmmqnk@ Try it online! Wouldn't surprise me if there's a shortcut or two I missed to construct the required values in fewer bytes (mmmm+++ is particularly gross), but managing the stack with duplicated values to be used later incurs its own ...


0

JavaScript, 166 bytes (o=-~0,O=o+[],e=O+0,c=e+0,q=O+c,d=c+0,p=e+O+O+O)=>[c+d,q+e+O,a=O+e+q,a,g=O+p+O,d+0+0,e+p,g,O+q+e,a,q+c,d+0+O].map(b=>String.fromCharCode(parseInt(b,o+o))).join([]+[]) I tried to use most circular alphabet as possible for the variable names.


1

R, 35 bytes substr(x<-scan(,''),1,nchar(x)/2+1) Try it online!


1

Keg, 7 bytes ^(!2/|_ That is easy but really hard to golf. Explanation ^ # Input in the right order (!2/ # Repeat half of length times: |_ # Pop the stack TIO


1

Keg, 8 bytes (SBCS) b;(|:1+ TIO


1

Keg, 14 bytes Hello World* TIO Keg does not have character literals, only instructions that push constants onto the stack, except for \, which pushes the character onto the stack. This program does not use integers. There are no built-functions that return the string in Keg. Keg does not support regex.


5

Java (5 or later), 15 characters 02367?\abcdeitu We've had a few previous answers in Java. The basic approach in all of them is to a) identify a minimal Turing-complete subset of the language, and b) find a minimal way to express the constructs of that language in Java's syntax. Hexagraph notation Let's look at b) first. As explained in @Poke's answer ...


2

Wolfram Language (Mathematica), score 16 #&' Floor@E 3 4 5 6 7 8 9 DDD=(DD(DD)DD(DD)DD(DD)DD(DD)DD(DD))~D~DD;DD=D~D~D;DDD 11 0!+0!+0!+0!+0!+0!+0!+0!+0!+0!+0!+0! -I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I-I*I Sum[u u,{u,Pi}] L|L|L|L|L|L|L|L|L|L|L|L|L|L|L//Length 2 2 2 2 Try it online! Characters used: !#&'()*+,-/0123456789;=@DEFILPS[]...


0

Japt -R, 5 4 bytes #ߢo Test it


1

(K+R)eg, score 32 Our task is to write as many programs / functions / snippets as you can, where each one outputs / prints / returns an integer. The integer is already on the stack, so it should have already returned the integer. The method of outputting does not matter. 1-9 implicit outputs the respective integer. We are using control characters for this. ...


1

Keg, 9 characters ~+-*/:{|} This subset of Keg was shown to compile to Volatile, which was in turn compiled to the Minsky Machine by TuxCrafting. The lack of output commands does not matter because Turing-completeness does not require output capabilities.


2

(K+R)eg, 9 bytes ߡï(.\ , Explanation: ߡ # Push 2017 ï # Count all the way from 0 # Due to the irritating output-without-newline: ( # Repeat the length of the stack times: . # Output the top of the stack \ ,# Output 1 newline TIO


0

Zsh, 35+35=70 bytes Neither program/function may contain any string or regex literals I am unsure whether [^$IFS] qualifies, since it is used in pattern matching. Here is a 45+45 solution in the case it is banned. Split: :<<<${#1//[^$IFS]} : <<<${(F)${=1}} Count: : <<<${#1//[^$IFS]} :<<<${(F)${=1}} The : ...


0

><>, 7 bytes aa+nen; You can try it on The Online ><> interpreter. Explanation a # push 10 a # push 10 + # push sum of top two values n # output top value as number e # push 14 n # output top value as number ; # halt program This doesn't print... 20 14 ...because n outputs the top value as a ...


0

Wolfram Language (Mathematica), 57 54 bytes (Apply[Equal]@#)~And~(1<Last[#])&@*Counts yEqd1<L*Co& Try it online!


2

05AB1E, 4 bytes ToRÀ Try it online! T # 10 o # 2**x (1024) R # reverse (4201) À # rotate left (2014) # implicit output


0

ink, 38 bytes Greetings, Planet!//!tenalP ,sgniteerG Try it online!


1

Javascript, 45 characters _=> new Date().getFullYear()-new Date().getDate() Very Temporary!! Another Day, another very Temporary answer :-) f=new Date().getFullYear()-new Date().getDay()


1

05AB1E, score 209 (189 bytes + 20 penalty for 1 letter) •£?;\:'%¢;.'¡£/':¢?'¢°':¢°#@¢«>#%¡¤;®[¢:¥¢:©¢:¦¢;®¢>#¡£#¨¢#&¢+¢#,¢:§¡¤#¬¢#@¢#)¢#(¢#<¢#¢#/¡£#¯¢#.¢#>¢#±¢#«¡¤#?¢;¢#\¢#°¢#:¢'¢#%•[₅‰`©®_#∞158+902201401301670804020409010150250102709022¾¡.¥>:ç? Try it online! The only letter is ç. The currency symbols €£¢ are not considered letters in ...


4

R, 90 bytes "?"=`u\164f8ToI\x6Et`;'!'=prod;!{y<-xtabs(~?readLines())}%in%{z<-y[1]}&z>T##&[]>~48bEfILpu Try it online! Outputs TRUE for a non-discriminating string, and FALSE for a discriminating string. I have written a lot of ugly code for challenges on this site, but I think this is the ugliest so far. 45 characters, used twice each ...


2

05AB1E, 100 58 52 bytes -6 bytes thanks to Kevin Cruijssen „„€€··™™……€€–– ……¹¹‚‚ ……––‚‚))εε##θθáá}}»»……!!θθJJ Try it online! „„€€· # dictionary string "g do" · # double (no effect on strings) ™ # title case: "G Do" ™ # title case again (no effect) ……€€–– # dictionary string "...


2

05AB1E, 71 bytes .•ǝ·Þ•“Ÿ™...Ûß,£Ô‚© I ÿ?“ćuì,u‘‚ï‘Qi“ºÆ,…Ü.‚ï.“ë“€¸.€Š€ˆn't€À I±….“}.ª, 05AB1E uses a custom code-page, but the lower- and uppercase characters are on the same hexadecimal positions on the code-page, so as long as I don't use worldWORLD it's fine. Try it online. Explanation: .•ǝ·Þ• # Push compressed string "greet" (which ...


1

Python 3, 206 bytes t=a,b,c,e,f='\u0057\u006f\u0072\u006c\u0064' exec(f'p=p{c}int;p("He{e}{e}{b}... eh, \u0077h{b}m sh{b}u{e}{f} I g{c}eet?");p(("Ah, yes. {t}.","N{b}. That isn\\'t \u0077hat I meant.")[input().tit{e}e()!=t])') Try it online!


1

05AB1E, 22 10 8 bytes ₁нTRžx¦J Try it online! How it works: ₁ pushes 256, and н pushes the first element. We get 2. T pushes 10, and R reverses it. We get 0 1. žx pushes 64, and ¦ removes the first element. We get 4. Lastly, we concatenate everything using J!


0

C (gcc), 208 205 202 bytes a[];main(){puts("He\x6c\x6c\x6f... eh, \x77h\x6fm sh\x6fu\x6c\x64 I g\162eet?");gets(a);puts((*a|' ')^1819438967|(a[1]|32)^100?"N\x6f. That isn't \x77hat I meant.":"Ah, yes. \x57\x6f\x72\x6c\x64.");} Try it online! Apparently you don't even have to specify an array length. Ungolfed: int a[]; // Array of ints....


0

Julia (1.2), 41 bytes "!tenalP ,sgniteerG";"Greetings, Planet!" Example julia> print("!tenalP ,sgniteerG";"Greetings, Planet!") "Greetings, Planet!" Explanation Putting a semicolon on the end of an expression makes the expression not output anything.


0

Python 3.7, 239 267 260 258 bytes a,b,c,e,f,g='\u0057','\u0077','\u006f','\u0072','\u006c','\u0064' exec(f'p=p{e}int;p("He{f}{f}{c}... eh, {b}h{c}m sh{c}u{f}{g} I g{e}eet?");p("Ah, yes. {a}{c}{e}{f}{g}."if input().{f}{c}{b}e{e}()=="{b}{c}{e}{f}{g}"e{f}se"N{c}. That isn\'t {b}hat I meant.")') Try it online! I had to write exec because I had to write p\...


0

Python 2 & 3, 39 bytes (function) lambda x,y:eval("abs(~"*x+str(y)+")"*x) Try it online! The * and + are string repetition and string concatenation, not mathematical operators. Explanation abs(~x) effectively increments x, so doing abs(~abs(~abs(...~abs(~x)))...) y times just increments n y times. Python 2, 54 bytes (program) x,y=input(),str(input(...


Top 50 recent answers are included