# Tag Info

0

brainfuck, 38 bytes +++++++++++++>+++[>,.<<.>>[->+<]<-]>>. Try it online! Explanation: The first 13 plus signs put the 'newline' character into cell 0. Then, I initialize cell 1 as a counter with a value of 3. Then there's the main loop. This loop will get a character in cell 2, display it, display the 'newline' character in ...

0

Factor, 25 bytes [ all-shortest supremum ] Try it online! Get the largest of the shortests.

0

Grok, 35 bytes j :zhq hx{y1py1pw*25xxY+zPY%*48py1p Try it Online! Gets input, then starts moving left through the main program, which juggles the register, where the running sum is stored, and the stack, where the input and some calculations are stored. Once all letters are printed and added, execution moves up to the middle row, where the sum is printed ...

1

Python 3, 282 276 bytes I managed to get the byte count under 300, I'm quite happy with that :). Edit: -6 bytes thanks to @ovs: rewritten ternary if ... else def f(h): m,t=[],[*-~len(h)for i in range(4)] for w in h: x='' for q in zip(w,'012'*len(w)):x+=q*(q>'L'or 3)+'3' x+='3'*6;m.append(x*450) for i in range(3600): for n in'0123'[3*(...

1

K (ngn/k), 16 bytes {|/x*c=&/c:#'$x} Try it online!$x convert the input to a list of strings c:#' count the number of characters/digits in each input, storing in c c=&/c generate boolean mask indicating which indices contain the minimal number of digits x* "mask-out" inputs that do not have the minimal number of digits (i.e., convert ...

0

PHP -F, 55 bytes for(;$c=ord($argn[$i++])%32;$r+=$c)echo"$c ";echo"$r "; Try it online! Quite straightforward solution.. 0 Red, 58 57 bytes -1 byte thanks to dingledooper! func[a][s: 0 foreach c a[s: s + probe 1 * c % 32]print s] Try it online! Takes a 3-letter string as input. Iterates over the string, converts each character to an integer (1 * c) and maps it to 1-26 by % 32. Prints this at each step using probe (it returns a value) and updates the sum, which is printed at the ... 0 Pyth, 11 bytes j+=%R32CMQs Try it here! 1 Jelly, 6 bytes DL$ÐṂṀ Try it online! How it works DL$ÐṂṀ - Main link. Takes a list L on the left$ÐṂ - Take the elements of L for which the following is minimal: DL - Digit Length Ṁ - Maximum of those elements

1

Python 3, 67 63 53 bytes -10 bytes by dingledooper i=[ord(c)%32for c in input()] *map(print,i+[sum(i)]), Try it online!

0

TI-BASIC, 30 bytes (on-calc) / 37 bytes (as text) Assumes list variable L₁ contains the array and variable N contains n. dim(L₁ Nsum(L₁,1,Ans-1)+L₁(Ans Explanation dim(L₁: Get the size of L₁, to be used in the next line as Ans. Nsum(L₁,1,Ans-1)+L₁(Ans: The sum( function has optional arguments to specify the beginning and end of a region of the list to be ...

1

TI-BASIC, 135 132 bytes (on-calc) / 145 135 bytes (as text) -3 bytes thanks to MarcMush! Input Str1 For(I,1,3 int(.5inString(" AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz",sub(Str1,I,1 Disp Ans A+Ans→A End A Explanation Input Str1: Take text input into string variable Str1. For(I,1,3: Start a for-loop with variable I from 1 to 3 (TI-...

1

SimpleTemplate 0.84, 107 77 bytes This code expects 1 argument passed to the compiler, with the 3 characters used for input. Outputs the text directly and doesn't return anything. {@eachargv.0}{@callord intoZ _}{@set%A.[__]Z 32}{@/}{@set+Y A}{@echoj"\n"A,Y} This is quite a messy mess... But you can try it on http://sandbox.onlinephpfunctions.com/...

1

Julia 1.0, 38 bytes r=read(stdin).%32 println.([r;sum(r)]) Try it online!

1

Ruby, 36 Bytes p $*.map{|c|p c.downcase.ord-96}.sum 1 C (gcc), 60 bytes i,j;f(char*s){for(i=0;printf("%d\n",j=*s&31?:i),*s++;i+=j);} Try it online! 3 Perl 5 + -pF, 27 bytes -6 bytes thanks to @Sisyphus!$\+=$;*say$;=31&ord for@F}{ Try it online!

3

Elixir, 70 bytes &(IO.puts Enum.reduce &1,0,fn b,c->IO.puts b=b-(b>91&&96||64) c+b end) Try it online!

2

JavaScript (Node.js), 61 bytes x=>[...[a,b,c]=[...x].map(z=>parseInt(z,36)-9),a+b+c].join  Try it online! x=>[ // Define a function taking a parameter x, returning an array of... ... // Iterating over... [a,b,c]= // assign a, b and c to... [...x].map(z=> // x mapped to... ...

2

Wolfram Language (Mathematica), 38 bytes (Print@Column[y=LetterNumber@#];Tr@y)& Doesn't seem to run in Try it online!, so here are some screenshots: And here is a superior 33-byte approach given by att in the comments: Print/@{##,+##}&@@LetterNumber@#& Try it online!

4

Factor + combinators.extras, 42 35 bytes 0 [ read1 32 mod dup . + ] thrice . Try it online! -7 bytes thanks to @MarcMush 0 Push 0, our sum, to the data stack. [ ... ] thrice Call a quotation three times. read1 Read one code point from standard input. 32 mod Modulo 32. dup . Output on its own line non-destructively. + Add it to the sum. . Print the sum.

2

Keg, 20 bytes 0&(3|?84*%:. ,&+&)&. Try it online! Why....why did I do this to myself? Explained 0& First of all, we put 0 into the register, because it is intialised as None. The register will be used to track the sum of the three letters. (3| Three times: ?84*% Take the next letter and modulo its ASCII value by 32. This trick is ...

5

Jelly, 7 bytes O%32Ṅ€S A full program that accepts a string of three letters and prints their alphabetic indices followed by their sum on four lines. Try it online! How? O%32Ṅ€S - Main Link: list of characters, C O - cast to ordinals A:65 ... Z:90 / a:97 ... z:122 %32 - modulo 32 A:1 ... Z:26 / a:1 ... z:26 Ṅ€ - print each followed ...

3

APL (Dyalog Extended), 10 bytes Full program. Prompts via stdin and prints to stdout +⌿⎕←⍪⎕A⍳⌈⍞ Try it online! ⍞ prompt via stdin ⌈ uppercase ⎕A⍳ indices in uppercase Alphabet ⍪ make into column ⎕← send to stdout +⌿‌ sum (and implicitly print to stdout)

2

Vyxal, 8 bytes ⇧C₆-:∑J⁋ Try it Online! Takes a 3 letter string and prints the required values. 7 bytes using a flag, 11 bytes if a single string isn't good or 9 if using flags Explained ⇧C₆-:∑J⁋ ⇧ # upper-case all the letters C₆- # subtract 64 from the ascii value of each letter : # the top of the stack now holds the alphabetical index of ...

2

Jelly, 9 bytes ŒuO_64Ṅ€S Try it online! Full program which takes a three-character string of letters as the first command line argument. 10 bytes to read from STDIN How it works ŒuO_64Ṅ€S - Main link. Takes [a,b,c] (a string) on the left Œu - Convert to uppercase O - Ordinal _64 - Subtract 64 (A -> 1, B - 2 etc.) € - Over ...

0

PostScript, 73 bytes Using binary encoding: 000000 31 88 01 88 64 7b 2f 69 92 3e 92 33 28 46 69 7a 000010 7a 42 75 7a 7a 29 69 88 0f 28 42 75 7a 7a 29 69 000020 20 35 28 46 69 7a 7a 29 69 88 03 33 7b 92 6a 30 000030 92 3d 7b 2f 69 92 3e 92 33 7d 7b 92 75 7d 92 55 000040 7d 92 83 69 20 3d 7d 92 48 (I can't give a TIO link as xpost doesn't support binary ...

1

Risky, 9 bytes -_{1+0+00_?+0+?*? Try it online!

1

Stax, 7 bytes é╟φQRl: Run and debug it

1

Japt -R, 22 bytes +17 bytes for the input validation and output formatting! :o õ ïV ú f@©"*+"øVÃòU mq Try it

2

Jelly, 51 bytes Ẓ&/Ä<5S‘x3ɓBSZḊḣ" O%9Ṭ€;Øỵ¬a"“µ¦¤‘ṁ$+⁴Fṁ⁽½c)ÇċⱮ€LŻ$ A monadic Link that accepts the list of patterns and yields the list of lists of counts. Try it online! How? Ẓ&/Ä<5S‘x3ɓBSZḊḣ" - Link 1: list of lists of colours at each second, L where F=25, C=21, A=19, and off=16 Ẓ - ...

4

Jelly, 55 bytes ŻI»0Ä’%3‘× Ø0œịŻṖÄ<5a O%9ÄṬ;Øỵ¬Ñṁ⁽½c)Zċþ3Sṭ$=þ@LŻ$ṪṭÇƊ§ Try it online! A full program taking a list of strings and printing a list of lists of integers. The first part (converting from Ss and Ls to the sequence dir each lighthouse was derived from @JonathanAllan’s answer to the previous challenge. Explanation Helper link 1 Convert a list ...

1

Python 2, 203 200 bytes E=enumerate l=input() t=eval([*-~len(l)]*4) for i in range(3600): for y,q in E(t):q[sum(y==((sum([~ord(w)%5*[j%3]+for j,w in E(c)],[])+*6)*450)[i]for c in l)^0-y/3]+=y*y|5>t[-1] print t Try it online! Building the pattern with strings instead of lists of digits comes out at the same length and is a bit faster: Try ...

3

05AB1E, 52 bytes Based on my answer to the previous challenge. ε€C9%Å10.ý˜7Å0«Dη_O3%>*60n∍}øÐ3QP.¥5‹Ï3LδQøs<dªεOZÝ¢ Try it online! ε€C9%Å10.ý˜7Å0« 60n∍} # see my previous answer Dη # push all prefixes of the signal _O # count the number of 0's (how often the signal was off) ...

4

J, 129 bytes <@(0,#\)(<:@(#/.~@,+/))&>[:(<@(+/),~]<@({.&.|:"2)~[:{:5{.!._[:>:@I.*/@{:)1 2 3=/(3600$(6$0),~&;[:(*&.>1 2 3$~$)19<@#:@|14+3&u:)&> Try it online!

1

Ruby - 20 chars g=->n{0**n|n*f[n-1]} Test irb(main):009:0> g=->n{0**n|n*f[n-1]} => #<Proc:0x25a6d48@(irb):9 (lambda)> irb(main):010:0> f => ...

1

R, 119 116 bytes Edit: -3 bytes thanks to Giuseppe function(a)table(c(rowSums(sapply(a,function(x)!1:3600%in%cumsum(rep(c(utf8ToInt(x)%%9,!!1:6),999)))),0:sum(a>0)))-1 Try it online!

1

Python 3, 154 bytes Very trivial approach: convert the code strings into sequences of 1s and 0s representing the seconds in which each lighthouse is ON or OFF; then cumulate the sum of seconds depending on how many lighthouses are on at the same time. def f(h): t=*(len(h)+1) for i in range(3600):t[[c[i]for c in[(x.replace('S','10').replace('L','1110')+...

2

Japt, 10 bytes Ò2nU²Ñ ¬ÄÄ Try it Ò2nU²Ñ ¬ÄÄ :Implicit input of integer U Ò :Negate the bitwise NOT of (i.e., floor and increment) 2n : Subtract 2 from U² : U squared Ñ : Times 2 ¬ : Square root ÄÄ :Add one twice

1

C++20, 202 bytes this is uncompetitive, but this was so fun I couldn't help but post it here. #include <bits/stdc++.h> using namespace std;auto f=[](int i){return i%15?(i%5?(i%3?to_string(i):"Fizz"):"Buzz"):"FizzBuzz";};int main(){for(auto i:views::iota(1,100)|views::transform(f))cout<<i<<endl;}

1

Wolfram Language (Mathematica), 20 bytes (14 characters) ⌊√(2#^2-2)⌋+3& Try it online! Shamelessly translating xnor's Python answer.

1

Java (JDK), 28 bytes L->L+=Math.sqrt(2*L*L-2)+3-L Try it online! Same as everyone, I guess, cheers to xnor! Same length as: L->(int)Math.sqrt(2*L*L-2)+3 Try it online!

0

Charcoal, 32 bytes ＩＥ⊕Ｌθ№Ｅ³⁶⁰⁰Σ⭆θ§⁺⪫Ｅν×1∨⁼πS³0×0⁷λι Try it online! Link is to verbose version of code. Explanation: For each number of "on" lighthouses and each second of the hour, calculate the "on" pattern for each lighthouse and count how many of the seconds had that number of lighthouses "on". θ ...

2

JavaScript (ES6), 113 bytes Expects an array of strings. Returns an object. a=>(n=3600,g=L=>n--?g(o[a.map(s=>t+=~~(s=s.replace(/./g,c=>c>g?10:1110))[n%(s.length+6)],t=0),t]=-~o[t]):o)(o={}) Try it online!

2

J, 60 53 52 bytes _1+(0,#\)#/.~@,[:+/(3600$(6$0),~&;19<@#:@|14+3&u:)&> Try it online! -7 after reading Jonathan Allen's idea of doing arithmetic on the character codes, though I use a different method which converts S to 2 and L to 14, and then converts those to binary. idea For each pattern, convert it into a bitmask where 1 is on, 0 is ...

1

Python 2, 125 117 bytes lambda a:map(map(sum,zip(*[sum([2*(c<'S')*+[1,0]for c in C],*6)*500for C in a]))[6:3606].count,range(len(a)+1)) -8 thanks to Jonathan Allan.

5

Jelly,  24 22 21  20 bytes O%9ÄṬ;Øỵ¬ṁ⁽½c)SċⱮLŻ$A monadic Link that accepts the list of lists of S and/or L characters and yields the ascending list of multiplicity counts. Try it online! Or see the test-suite. How? O%9ÄṬ;Øỵ¬ṁ⁽½c)SċⱮLŻ$ - Link: lighthouse patterns, P ) - for each pattern in P: say, 'SLSL' O - cast to ...

3

05AB1E, 25 bytes ε€C9%Å10.ý˜7Å0«60n∍}øOZÝ¢ Try it online! ε } # for each lighthouse in the implicit input: €C # convert each character from binary 9% # modulo 9: S -> 28 %9 = 1, L -> 21%9 = 3 Å1 # for each number in the resulting list get a list of ...

2

Vyxal, 7 bytes *d⇩√3+⌊ Try it Online! Shameless port of xnor's answer * # Square d # Double ⇩ # Subtract 2 √ # Square root 3+ # Add 3 ⌊ # Floor

1

Vyxal, 7 bytes 19βN9%‹ Try it Online!

Top 50 recent answers are included