title: Output the full name of titin

text:
# Question
Title: Output the full name of titin
Titin is a protein found in muscle tissue. It is a pretty big protein, and its full chemical name is giant as well. Comprising 189819 characters, the full name of titin would take about 3.5 hours to pronounce. Your task is to output this entire name!

# Details

The full name can be found here: Gist (this file does not include the trailing newline)

The MD5 hash of the output is `ec73f8229f7f8f2e542c316a41cbfff4` (without a trailing newline) or `628c6eb157eb1de675cfc5b91a8149ce` (with a trailing newline).

* You may not access an external resource, be it a file or an internet location.
* You must output only the exact text from the pastebin to STDOUT or STDERR. Nothing else should be output to your chosen output stream; leading and trailing whitespace are acceptable.
* You may not assume there will be any input, but you may assume that there will be no input if needed.
* You may output anything to the other output stream (STDOUT if you chose to output to STDERR and vice versa)
* Standard loopholes apply

This is a challenge, so the shortest program in bytes wins!

# EDIT

This is NOT a duplicate of the Rick Astley "Never Gonna Give You Up" challenge. Besides the tags, they're not even similar. In that one, output is a multi-line song with a few sections that repeats the first two words of every line. In this one, output is a fairly compressible string with 189819 letters. Please don't close-vote this as a dupe of that.

# Answer
> 15 votes
# Bash + sed + paq8kx v7, 11682 bytes

The submission consists of two files: an arbitrarily named Bash script (*23 bytes*) and a paq8kx archive named **a** (*11657 bytes*, plus *1 byte* for the extra file, plus *1 byte* for the specific filename).

### Bash script

```
paq8kx -d a>t
sed -fd b

```

### a (base64 encoded)

```
[encoded data, 15544 characters]

```

### Verification

```
$ bash titin.sh | md5sum
ec73f8229f7f8f2e542c316a41cbfff4  -

```

### How it works

The first line of the Bash script – `paq8kx -d a>t` – decompresses the archive **a**, redirecting its output to **t**. The redirection is required as *paq8kx* prints information to STDOUT, which should not be part of the final output. Said information will look as follows.

```
Extracting ./b 26926 -> done
Extracting ./d 307 -> done
Time 15.36 sec, used 1929185730 bytes of memory

```

This creates a sed script **d** with the following content.

```
s/T/methionyl/g
s/S/cysteinyl/g
s/R/histidyl/g
s/Q/tryptophyl/g
s/P/phenylalanyl/g
s/O/glutaminyl/g
s/N/tyrosyl/g
s/M/asparaginyl/g
s/L/arginyl/g
s/K/aspartyl/g
s/J/alanyl/g
s/I/isoleucyl/g
s/H/leucyl/g
s/G/glycyl/g
s/F/prolyl/g
s/E/seryl/g
s/D/threonyl/g
s/C/lysyl/g
s/B/glutamyl/g
s/A/valyl/g
s/..$/ine/g

```

It also creates a large (printable) binary stream that encodes the different parts of titin's name.

```
TDDOJFDPDOFHOEAAAHBG<26886 more uppercase letters>EHGMBPGEKEJDAMIRILEI

```

Finally, the second line – `sed -fd b` – executes the sed script **d** on the file **b**, printing the desired output to STDOUT.

# Answer
> 25 votes
# JavaScript (ES6), ~~16840~~ ~~16825~~ 16814 bytes

*Saved a couple of bytes by:*

* *inserting the last acid prefix in the packed string as suggested by ETHproductions*
* *choosing the next character group in a slightly more efficient way when there's a tie*

---

Assumes Windows-1252 character encoding. Outputs without a trailing newline.

Below is a simplified version without any actual data.

```
[...Array(256)].map((_,i)=>i<52|i>126&i<161|i==92|i==96?0:s=s.split(String.fromCharCode(i)).join(`...dictionary...`.slice(j,j+=2)),j=0,s=`...packed_data...`)&&[...s].map(c=>'methion|threon|glutamin|alan|prol|phen|leuc|ser|val|glutam|glyc|histid|isoleuc|tryptoph|argin|aspart|lys|asparagin|tyros|cystein'.split`|`[c.charCodeAt()-32]).join`yl`+'ine'

```

And here is the full version:

Try it online!

The TIO link includes some additional code to print the MD5 of the output rather than printing the output itself:

`ec73f8229f7f8f2e542c316a41cbfff4`

### How?

This was compressed by:

1. Mapping the 20 distinct amino acids to ASCII characters 32 to 51.
2. Repeatedly replacing the most frequent 2-character group by a new ASCII character in the following ranges:
    * 52-91
    * 93-95
    * 97-126
    * 161-255

Which leaves us with a dictionary of 336 bytes (168 entries of 2 characters) and a final compressed string of 16161 bytes.

The above code is doing the exact opposite.

# Answer
> 17 votes
# Mathematica, 319 + 14971 = 15290 bytes

```
For[p={};a={t={{{{{tyros,asparagin},prol},{ser,threon}},{{lys,alan},{glutam,val}}},{{{{phen,{methion,cystein}},argin},{aspart,{glutamin,{histid,tryptoph}}}},{leuc,{,glyc}}}},r=Join@@IntegerDigits[BinaryReadList@"b",2,8]},r!={},If[AtomQ@a,p=Join[p,{a,yl}/.{,yl}->{iso}];a=t,a=a[[1+#&@@r]];r=Rest@r]];##~Print~leucine&@@p

```

*Incredibly, this is exactly one byte more than this bzip2 answer. Can somebody find a couple of bytes to save?!*

This is a program that prints the full name of titin to STDOUT. We use the same structure described in Jörg Hülsermann's PHP answer, and additionally note that all the words except for `"iso"` end in `"yl"`, which we add separately each time unless inappropriate (this is what `p=Join[p,{a,yl}/.{,yl}->{iso}]` does). We store the data in a 14971 -byte file called `"b"` in the working directory (hex dump is here), which is converted to the list of its corresponding bits by `Join@@IntegerDigits[BinaryReadList@"b",2,8]`.

That list of bits has been determined by Huffman coding, which is a lovely data compression scheme that takes relative frequencies into account; it requires the decoding template, stored here as the binary tree `t`, as well as the raw list of bits. Inexplicably, Mathematica doesn't have a Huffman decoding (or encoding) built-in, so that's what the `For`-loop implements.

# Answer
> 17 votes
# Bash \+ sed + xz, ~~13322~~ ~~13290~~ ~~12785~~ ~~12706~~ ~~12694~~ ~~12687~~ 12681 bytes

```
sed 1d $0|unxz|sed /`sed 's:[A-T]:yl/g;s/&/:g'<<<AvalBglutamClysDthreonEserFprolGglycHleucIisoleucJalanKaspartLarginMasparaginNtyrosOglutaminPphenylalanQtryptophRhistidScysteinTmethion`yl/g\;s/yl$/ine/
<12479 bytes of binary data>

```

Try it online!

# Answer
> 8 votes
# Pip, ~~27747~~ ~~27081~~ ~~19701~~ 19229 bytes

Take that, Bubblegum!

```
O("alan argin asparagin aspart cystein glutam glutamin glyc histid isoleuc leuc lys methion phenylalan prol ser threon tryptoph tyros val"^sA*Y"..."R^(PA3,68)."xyz{|}~
 !"Y"uttscfkmovgsmmoshiwnqtwjgioettdwnmvmfisgnjdgkrvik nrdrerjikomezastkvktssdewmdogtvtwweidsrineogsiwedkngwfotnsdtnomowrmsqemikiksoidiorntgkmtniwswowirrwt"<>2)J"yl""ine"

```

where `"..."` is a very long string. Here's the full code as a Gist.

Try it online! (Results are truncated.)

Strategy: split the name on `yl`, and encode each piece as one of the lowercase letters `d` through `w`. Use their code points (between 100 and 119) to index into the list of pieces (which is of length 20, so the indices are taken mod 20 automatically). Join on `yl`, output, and tack `ine` on the end.

Further compression: find the most common pair of letters in the encoded string, and replace it with an unused ASCII character. Repeat for all ASCII characters `#` through `c`, `xyz{|}~!`, space, and newline. The code takes this twice-compressed string and replaces the characters that aren't `d` through `w` with their corresponding two-character strings. Goto paragraph 1.

# Answer
> 6 votes
# PHP 18731 Bytes

```
echo strtr(bzdecompress(base64_decode("$base64encodedstring")),
[A=>alanyl,B=>arginyl,C=>aspartyl,D=>asparaginyl,E=>cysteinyl,F=>glutaminyl
,G=>glutamyl,H=>glycyl,I=>histidyl,J=>isoleucyl,K=>leucyl,L=>lysyl
,M=>methionyl,N=>phenyl,O=>prolyl,P=>seryl,Q=>tryptophyl,R=>threonyl
,S=>tyrosyl,T=>valyl,U=>isoleucine]);');

```

Try it online!

Create the Base64 string

Replacement of all words with uppercase chars in the range A-U after that bzip2 and base64 encoding

```
$a=preg_replace(["#alanyl#","#arginyl#","#aspartyl#","#asparaginyl#","#cysteinyl#","#glutaminyl#","#glutamyl#","#glycyl#","#histidyl#",
"#isoleucyl#","#leucyl#","#lysyl#","#methionyl#","#phenyl#","#prolyl#","#seryl#","#tryptophyl#","#threonyl#","#tyrosyl#","#valyl#","#isoleucine#"],range("A","U"),$titin);
$z=base64_encode(bzcompress($a));

```

## PHP, 19920 Bytes

After replace the words with numbers and create a very long decimal number I can only read the word "leucine"

I have 20 words found that I have replace with numbers

After that i use bzcompress and the last action was base64 encoding

```
$g="base64String"; # see online version
echo $o=strtr(bzdecompress(base64_decode($g)),array_flip(
["methionyl"=>9999,"cysteinyl"=>9990,"histidyl"=>9909,"tryptophyl"=>9090
,"phenyl"=>9009,"glutaminyl"=>9000,"tyrosyl"=>899,"asparaginyl"=>889
,"arginyl"=>888,"aspartyl"=>800,"iso"=>70,"glycyl"=>79
,"prolyl"=>78,"seryl"=>77,"threonyl"=>6,"lysyl"=>5
,"alanyl"=>4,"glutamyl"=>3,"valyl"=>2,"leucyl"=>1]));

```

Online Version gzinflate

## The words and count

```
[methionyl] => 337
[threonyl] => 2083
[glutaminyl] => 724
[alanyl] => 2304
[prolyl] => 1834
[phenyl] => 672
[leucyl] => 3351
[seryl] => 1910
[valyl] => 2414
[glutamyl] => 2324
[glycyl] => 1731
[histidyl] => 391
[iso] => 1658
[tryptophyl] => 401
[arginyl] => 1405
[aspartyl] => 1430
[lysyl] => 2199
[asparaginyl] => 902
[tyrosyl] => 829
[cysteinyl] => 356

```

# Answer
> 5 votes
# Bubblegum, 19655 bytes

```
0000000: e2 e5 7a 4c bf 5d 00 36 99 4a ef 2b 08 5d b1 93  ..zL.].6.J.+.]..
0000010: 69 cb 7a 61 51 8c 3c 7c 04 41 de 7e ea ed 68 3c  i.zaQ.<|.A.~..h<
0000020: ca 5c e1 c8 6c 5b b5 31 2d 0b 4e e2 8e 52 06 ec  .\..l[.1-.N..R..
0000030: 5e e6 da d5 f2 f5 d3 8f 83 a3 51 0b 45 5d 19 c6  ^.........Q.E]..
.
.
.

```

Here's a full hexdump.

You have to paste the code manually, but you can Try it online! (only shows the first 128 KiB)

# Answer
> 4 votes
# bzip2, 15287+2 bytes

```
BZh91AY&SY...

```

Full source (hex-encoded). Run with `bzip2 -c`. Where do I pick up my "best programmer" trophy?

# Answer
> 4 votes
# , 17684 bytes

```
E="/Td6WFoAAA..." # base64 string reduced for better readability
U=unlist(lapply(match(utf8ToInt(E),c(22:47,54:79,5:14,0,4)+43)-1,function(x)x%/%2^(5:0)%%2))
D=memDecompress(as.raw(sapply(split(U,0:(length(U)-1)%/%8),function(x)sum(x*2^(7:0)))),'x',T)
for(i in 1:21)D=gsub(LETTERS[i],paste0(el(strsplit("phenylalan valylthreon isoleuc leuc val glutam alan lys threon ser prol glyc aspart argin asparagin tyros glutamin tryptoph histid cystein methion"," ")),"yl")[i],D)
cat(D,"isoleucine",sep='')

```

Try it online!

The approach is similar to other answers :

1. Remove the suffix `"isoleucine"` from the original string
2. Replace each occurrencies of the following tokens with an uppercase letter in the range `A-U` :

```
        TOKEN   REPLACEMENT
 phenylalanyl             A
valylthreonyl             B
    isoleucyl             C
       leucyl             D
        valyl             E
     glutamyl             F
       alanyl             G
        lysyl             H
     threonyl             I
        seryl             J
       prolyl             K
       glycyl             L
     aspartyl             M
      arginyl             N
  asparaginyl             O
      tyrosyl             P
   glutaminyl             Q
   tryptophyl             R
     histidyl             S
    cysteinyl             T
    methionyl             U

```

obtaining a string of 26610 characters
3. compress the string using the R builtin `memCompress(string,"xz")` obtaining a raw vector of length 12936 (bytes)
4. encode the vector to base64 (because I don't know a better way to store these bytes into the script) obtaining a string of 17248 characters

The code does exactly the opposite (from points 4 to 1) and prints the string to stdout. The TIO captures this outputs, save it to a file and compute the md5 hash to verify that is correct.

Note: we can't compute md5 directly on string because we need a package that is not installed on TIO.

* **saved 37 bytes thanks to J.Doe**

# Answer
> 3 votes
# PHP, ~~19851~~ 18639 bytes

~~204 bytes code + 19647 bytes base64 data~~
207 bytes code + 18432 bytes base64 data

```
for(;$c=bzuncompress(base64_decode("[encoded data, 18432 characters]"))[$i++];)echo[val,glutam,alan,lys,threon,ser,prol,glyc,leuc,isoleuc,aspart,argin,asparagin,tyros,glutamin,phen,tryptoph,histid,cystein,methion][ord($c)],$i<27598?yl:ine;

```

or, without the data:

```
for(;$c=bzuncompress(base64_decode(""))[$i++];)echo[val,glutam,alan,lys,threon,ser,prol,glyc,leuc,isoleuc,aspart,argin,asparagin,tyros,glutamin,phen,tryptoph,histid,cystein,methion][ord($c)],$i<27598?yl:ine;

```

---

I took the words ordered by number of appearances (descending), replaced them with bytes 0..19 (`isoleucyl` and `isoleucine` share code `9`) followed by ~~`gzdeflate`~~ `gzcompress` and `base64_encode`. In PHP:

```
echo base64_encode(bzcompress(strtr($o,[asparaginyl=>chr(12),glutaminyl=>chr(14),tryptophyl=>chr(16),cysteinyl=>chr(18),isoleucyl=>chr(9),methionyl=>chr(19),aspartyl=>chr(10),glutamyl=>chr(1),histidyl=>chr(17),threonyl=>chr(4),arginyl=>chr(11),tyrosyl=>chr(13),alanyl=>chr(2),glycyl=>chr(7),leucyl=>chr(8),phenyl=>chr(15),prolyl=>chr(6),lysyl=>chr(3),seryl=>chr(5),valyl=>chr(0),isoleucine=>chr(9)])));

```

Moving from A..T to 0..19 did not only save 4 bytes of code (`65=>`), but also 3 bytes of encoded data (with `gzdeflate`; I didn´t test again).

---

replacements, words and count:

```
 0 val          # 2414
 1 glutam       # 2324
 2 alan         # 2304
 3 lys          # 2199
 4 threon       # 2083
 5 ser          # 1910
 6 prol         # 1834
 7 glyc         # 1731
 8 leuc         # 1694
 9 isoleuc      # 1657+1
10 aspart       # 1430
11 argin        # 1405
12 asparagin    #  902
13 tyros        #  829
14 glutamin     #  724
15 phen         #  672
16 tryptoph     #  401
17 histid       #  391
18 cystein      #  356
19 methion      #  337

```

# Answer
> 2 votes
# Python 2, ~~18409~~ 18403 bytes

(with no libraries)

```
n=sum(95**i*(ord(v)-32)for i,v in enumerate(r'''~'W/P58:`Ote}|QRokHosM/W%~zh%Ab*ZI~i4?=Z/$_-Y*6D{ EGAP\ENvC,4=v$YQ#Z=<)e^5!p5*|K/Ap|.?CyO*51Ladt8c`it>w~1w2@{8.kb%;2n}Xvp8d{/GE4_c'8dO\)Qu(5G8[::X-(cMkgKeUli@0HJNa@Y84p^~:8'Jn #BoNyJn#5KAy[Lb} K{i=TlKzA^#EBWd>,|Ut!V.y5GCiXrO?~'dGYY;Pg6A|ub<ASiLi_@gL?Fb14=!x4-HE@4>3<_thTv&~8X%T2@;gaQy8Ao=DAnI50|7N6_lh=~7gF-@;CmFz:]?aBr~]K}eoFh{nG!4&:T>MSKxB6{N0TJ<ig@Md(ix?*\$;E0H5<f/M7EubRYLA1`A_Cuu0g"]!#w,Hf/uH2(a~~41\D.w"pg|{vO=.a)(xE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VM_FkOD0&glK!\g5XC(N7I`P3o|LlSvz572xjsA_2eDAFDxO|Rk8,m]TL4Lt]/|nCU.xPG$i$Xz\Y<:tv+E%Gl`A&},3(BzDRLJC?&<`fB`d,jsch+ib4Fl?eMGcU RpQ1`l4u$:pHe)ihm{#L"NbN @S@BUI-{V)'@6Ug?ZMK]**fL'''))
r='isoleucine'
while n:d=n%20;n=n/20;r='cystein methion threon glutamin glutam alan prol phen leuc ser val glyc histid isoleuc tryptoph argin aspart lys asparagin tyros'.split()[d]+'yl'+r
print r

```

Creates a number, `n`, by reading a raw string using characters between `' '` and `'~'` as digits in base-95. Decodes that as a base-20 number using parts of the full name of tintin as the digits adding `'yl'` each time, and initialising with the trailing `'isoleucine'` and `prints` the result.

# Answer
> 2 votes
**Python 2, 14627 bytes**

* Encode the amino acids as bytes, from \x00 to \x13 Special treatment for phenyl which only arises as phenylalanyl. No special treatment for iso in isoleucyl, just a different group than leucyl. Special treatment for the -ine.
* encode the string with bz2
* custom base 216 encoding of the bz2 binary string (218 printable characters in cp1252 excluding ' and \ for ease of use in a string literal.) encoding 31 bytes in 32 printable characters.

Source with cut down string s:

```
#coding:cp1252
a='glutamin tryptoph leuc val aspart isoleuc glutam methion alan glyc phenylalan prol argin threon asparagin cystein lys histid tyros ser'.split()
p=[chr(x)for x in range(32,256) if x not in(39,92,127,129,141,143,144,157)]
s='ª9W¾½ÍWÕiì7.{ç5æÄ‚¯g×;NíbdXÔùP¯ ...'
d=''
for i in range(0,14241,32):
 c=s[i:i+32];n=i=0
 for c in c:n+=p.index(c)*216**i;i+=1
 for _ in s[:31]:n,c=divmod(n,256);d+=chr(c)
print'yl'.join(a[ord(c)]for c in d.decode('bz2'))+'ine'

```

# Answer
> 2 votes
# Pascal (FPC), 27917 bytes

```
{$H+}const s='<Compressed_string>';var c:char;a:array['A'..'T']of string=('methionyl','threonyl','glutaminyl','alanyl','prolyl','phenyl','leucyl','seryl','valyl','glutamyl','glycyl','histidyl','isoleucyl','tryptophyl','arginyl','aspartyl','lysyl','asparaginyl','tyrosyl','cysteinyl');begin for c in s do write(a[c]);write('isoleucine')end.

```

Try it online!

Compressed string

Hash print of the output

Compressed string, along with count of each string ending with `yl`, was made using this:

```
type part=record
      name:AnsiString;
      count:QWord;
     end;
var s:AnsiString;
    c:QWord=0;
    a:array[0..50] of part;
    i,j:word;
    p:word;
begin
  read(s);
  p:=pos('yl',s);
  while p>0 do begin
    c:=c+p;
    //writeln(c);
    j:=0;
    while j<i do begin
      if a[j].name=s[1..p+1] then begin
        Inc(a[j].count);
        break;
      end;
      j:=j+1;
    end;
    if j=i then begin
      a[i].name:=s[1..p+1];
      i:=i+1;
    end;
    write(chr(j+ord('A')));
    Delete(s,1,p+1);
    p:=pos('yl',s);
  end;
  writeln(' + isoleucine');
  for j:=0 to i-1 do writeln(j:3,chr(j+ord('A')):2,' ',a[j].name:20,' ',a[j].count);
end.

```

# Answer
> 2 votes
# Deadfish~, 1103473 bytes

View source here

By far the longest answer I've ever done, and probably one of the longest (non-Unary) on Code Golf. Definitely longer than all my other answers and questions put together.

# Answer
> 2 votes
# JavaScript (Node.js), 16071 bytes

```
_=>[...Array(27598)].map(_=>'isoleuc|methion|threon|glutamin|alan|prol|phen|leuc|ser|val|glutam|glyc|histid|tryptoph|argin|aspart|lys|asparagin|tyros|cystein'.split`|`[a/=20n,a%20n],a=0n,[...`-}Þ÷...Ý¦û´`].map(i=>[i=i.charCodeAt(),i-=i<127?34:68,a=a*188n+BigInt(i<0?66+4*i:i)])).join`yl`+'ine'

```

Try it online!

Generator used

# Answer
> 1 votes
# Python, 32148 bytes

```
import zlib, base64
exec(zlib.decompress(base64.b64decode('[encoded data, 32084 characters]')))

```

**Explanation:** All that nonsense inside the `exec()` statement is actually the compressed version of `print('methionyl...'`

As per the OP's instructions, the hash of the output is `ec73f8229f7f8f2e542c316a41cbfff4`

This program uses the inbuilt Python modules `zlib` and `base64`

---
Tags: code-golf, kolmogorov-complexity, chemistry
---


title: Pretty-print my BQN Arrays

text:
# Question
Title: Pretty-print my BQN Arrays
Marshall Lochbaum's online BQN REPL has an interesting(and aesthetically pleasing) method of displaying arrays. Your task is to implement a version with simpler rules.

```
[2,[3],4,[[[6,[5],7]]]]

```

becomes:

```
┌─
· 2 ┌·    4 ┌·
    · 3     · ┌·
        ┘     · ┌─
                · 6 ┌·    7
                    · 5
                        ┘
                            ┘
                              ┘
                                ┘
                                  ┘

```

## Rules for drawing

* A singleton array has

```
┌·
·

```

as its top left corner.

* A non-singleton array has

```
┌─
·

```

as its top left corner.

(In the actual BQN, this is used for rank-0, or "unit" arrays)

* All arrays have

as their bottom right corner.

* Each element at a certain depth will be displayed at the same depth vertically. For example, 2 and 4 are displayed 1 unit from the top since they are at depth 1.
* Each further level of nesting depth moves 1 unit down in depth.
* Numbers next to each other will be separated by a single space.

## Other details

* You may take a ragged numeric array in any way your language supports.
* The input will only consist of integers and nested arrays containing integers.
* If your language does not support arrays with depth, you may take a string/other equivalent that your language supports.
* If your language's codepage does not contain the characters `┌ · ─ ┘`, you can count them as 1 byte.
* This is . Shortest answer in each language wins.
* Since bacon strips are thin, your code must be thin and small as well.

# Answer
> 6 votes
# Charcoal, 72 bytes

```
ＦＳ≡ι(«⊞υⅉＰ⌈┌´·↘→⊞υⅉ»)«≔⊕⊟υιＭ¹⁻ιⅉ┘Ｍ⁻ⅉ⊟υ↑¿υ⊞υ⌈⟦ι⊟υ⟧»,«↑≔ＫＤ⊕ⅈ←ι§≔ι⊖⌕ι┌¦─↘»ι

```

Try it online! Link is to verbose version of code. Uses lists rather than arrays because they're easier to input. Explanation:

```
ＦＳ≡ι

```

Switch over each character of the input as a string.

For a `(`, ...

```
⊞υⅉ

```

... save the vertical position as the top margin, ...

```
Ｐ⌈┌´·↘→

```

... assume a single-element list, ...

```
⊞υⅉ

```

... and save the vertical position again, this time as the bottom margin.

```
»)«

```

For a `)`, ...

```
≔⊕⊟υι

```

... get the bottom margin of this list, plus 1, ...

```
Ｍ¹⁻ιⅉ

```

... move to that row, ...

... close the list, ...

```
Ｍ⁻ⅉ⊟υ↑

```

... move to and forget the top margin of this list, ...

```
¿υ⊞υ⌈⟦ι⊟υ⟧

```

... and update the bottom margin of the containing list if necessary.

```
»,«

```

For a `,`, ...

```
↑≔ＫＤ⊕ⅈ←ι

```

... grab the text on the previous row, ...

```
§≔ι⊖⌕ι┌¦─

```

... find the  and change the character after it to a , ...

... and move to the next column on the original row.

```
»ι

```

Otherwise, just output the current character.

Note that the `·` is in Charcoal's code page (so because it needs to be quoted it ends up costing me two bytes!) but the box-drawing characters are not. They would normally cost three bytes in Charcoal so as I use them four times I have subtracted 8 bytes from Charcoal's calculation.

---
Tags: code-golf, ascii-art
---


title: Draw the flag of Tennessee

text:
# Question
Title: Draw the flag of Tennessee
The flag of Tennessee is specified by chapter 498 of the Public Acts of 1905.

> An oblong flag or banner in length one and two thirds times its width, the large or principal field of same to be of color red, but said flag or banner ending at its free or outer end in a perpendicular bar of blue, of uniform width, running from side to side; that is to say, from top to bottom of said flag or banner, and separated from the red field by a narrow margin or stripe of white of uniform width; the width of the white stripe to be one-fifth that of the blue bar; and the total width of the bar and stripe together to be equal to one-eighth of the width of the flag.
>
> In the center of the red field shall be a smaller circular field of blue, separated from the surrounding red field by a circular margin or stripe of white of uniform width and of the same width as the straight margin or stripe first mentioned. The breadth or diameter of the circular blue field, exclusive of the white margin, shall be equal to one-half of the width of the flag. Inside the circular blue field shall be three five-pointed stars of white distributed at equal intervals around a point in the center of the blue field and shall be of such size and arrangement that one point of each star shall approach as closely as practicable without actually touching one point of each of the other two around the center point of the field; and the two outer points of each star shall approach as nearly as practicable without actually touching the periphery of the blue field. The arrangement of the three stars shall be such that the centers of no two stars shall be in a line parallel to either the side or end of the flag, but intermediate between same; and the highest star shall be the one nearest the upper confined corner of the flag.

Here is the flag, with annotations for its ratios:

Your task is to draw this flag in a way that complies with the statute. However, because the statute is ambiguous, you have some wiggle room with what you output. Specifically:

* You may use any colors reasonably recognizable as "red", "white", and "blue". (The sample image uses `#cc0000`, `#002d65`, and `#ffffff`.)
* The "stars" may have any exterior or interior angles. But all the interior angles must be equal, all the exterior angles must be equal, all edges must be the same length, it must have ten edges and ten vertices, and it must be reasonably recognizable as a five-pointed star.
* The stars must be as large as "practicable" so that their points do not touch each other in the center or the white band around the edge of the circle. Between the two points of each star closest to the edge and the edge, and between the points approaching the center of any two stars, there must be at least 1 pixel of space but not more than 1/48 of the length of the flag.
* The centers of the three stars may form any equilateral triangle, so long as no side of the triangle is parallel to an edge of the flag, and the vertex closest to the top of the flag is closer to the top left corner than the top right corner.

Shortest code wins.

# Answer
# PostScript, ~~346~~ 315 bytes

Code (compressed version):

```
5 5 scale<</C {setrgbcolor}/R{1 0 0 C}/B{0 0 1 C}/W{1 setgray}/o{closepath fill}/c{0 360 arc o}/f{rectfill}/t{translate}/p{currentpoint}/s{gsave p t 4{0 -11 lineto p t -144 rotate}repeat o grestore}>>begin R 0 0 74 48 f B 75 0 5 48 f W 37 24 13 c B 37 24 12 c W 37 24 t 3{-.1 -.5 moveto s 120 rotate}repeat showpage

```

Code (uncompressed version):

```
5 5 scale                 % over-all scale

% define some short-named procedures for later use
<<
  /C {setrgbcolor}
  /R {1 0 0 C}            % set red color
  /B {0 0 1 C}            % set blue color
  /W {1 setgray}          % set white color
  /o {closepath fill}
  /c {0 360 arc o}        % draw circle
  /f {rectfill}
  /t {translate}
  /p {currentpoint}
  /s {                    % draw 5-pointed star
    gsave
    p t
    4 {
      0 -11 lineto          % one line of star
      p t
      -144 rotate           % rotate by 144°
    } repeat
    o                       % fill the star
    grestore
  }
>> begin

R 0 0 74 48 f             % draw big red rectangle
B 75 0 5 48 f             % draw blue rectangle
W 37 24 13 c              % draw white circle
B 37 24 12 c              % draw blue circle
W
37 24 t                   % translate to center of circle
3 {
  -.1 -.5 moveto          % move a little off the center
  s                       % draw white star
  120 rotate              % rotate by 120°
} repeat
showpage

```

Result:
> 7 votes

# Answer
# HTML+CSS 28+291 = 319 bytes

Tested on FireFox 69 and Chrome 77 on Windows 10 1903.

```
*{position:absolute}c,d{height:480px}d,e{background:blue}c{width:700px;background:red}d{width:84px;left:716px}e{width:240px;height:240px;left:214px;top:104px;border-radius:100%;color:#FFF;border:16px solid}f{left:21px;top:-44px}g{font-size:150px;transform:rotate(120deg);top:65px;left:110px}
```

```
<c><d></d><e><f><g>★<g>★<g>★
```

---

# HTML+CSS 28+278 = 306 bytes

This version uses % instead of pixels, so some places can be off by a tiny amount of pixels, but CSS is shorter.

```
*{position:absolute}c,d{height:480px}d,e{background:blue}c{width:700px;background:red}d{width:84px;left:102%}e{width:34%;height:50%;left:31%;top:22%;border-radius:100%;color:#FFF;border:16px solid}f{left:9%;top:-19%;font-size:938%}g{transform:rotate(120deg);top:65px;left:110px}
```

```
<c><d></d><e><f><g>★<g>★<g>★
```
> 6 votes

# Answer
# Scratch, 530 bytes

Try it online!

I will be explaining the code here as well as in Scratch so that parameters can be more easily confirmed. Note that 1/48 = 2 pixels. Alternatively, 43 blocks

```
define W
set pen color to(#fff
define B
set pen color to(#036
when gf clicked
set y to(-48
erase all
set pen size to(1
pen down
repeat(96
change y by(1
set x to(86
B
set x to(76
W
set x to(74
set pen color to(#c00
set x to(-74
end
go to x:()y:(
set pen size to(52
W
pen down
set pen size to(48
B
pen down
set pen size to(1
W
repeat(3
pen up
go to x:()y:(
turn cw(120)degrees
move(2)steps
pen down
set[S v]to(20
repeat(9
change[S v]by(-2
turn cw(18)degrees
move(1)steps
turn ccw(18)degrees
repeat(5
move(S)steps
turn cw(144)degrees

```

## Definitions

```
define W                Combined, these definitions save ~ 40 bytes
set pen color to(#fff   Sets the pen color to white
define B                Note that these hex values are approximations - they may not be perfectly replicated in vanilla Scratch
set pen color to(#036   Sets pen color to blue

```

## Base

```
when gf clicked         Initiates code
set y to(-48            Sets y position to the bottom of the flag
erase all               Clears the stage
set pen size to(1       Resets the pen to be 1 pixel in diameter
pen down                Applies the pen
repeat(96               Loops code for each row of pixels in the flag
change y by(1           Moves y position to the next row
set x to(86             Sets the x position to the right side of the flag
B                       Sets pen color to blue
set x to(76             Draws a horizontal line 10 pixels long
W                       Sets pen color to blue
set x to(74             Draws a horizontal line 2 pixels long
set pen color to(#c00   Sets pen color to red
set x to(-74            Draws a horizontal line 148 pixels long
end                     Signifies the end of the code that should be looped

```

## Circles

```
go to x:()y:(        Sets position to the center of the red field (which, for optimization, is the origin)
set pen size to(52   Sets the diameter of the pen to 52 pixels (diameter of the white ring)
W                 Sets the pen color to white
pen down             Applies the pen
set pen size to(48   Sets the diameter of the pen to 48 pixels (diameter of the blue circle)
B                    Sets the pen color to blue
pen down             Applies the smaller blue circle onto the white, making the ring

```

## Stars

```
set pen size to(1     Sets the diameter of the pen to 1 pixel
W                     Sets the pen color to white
repeat(3              Loops code for each star
pen up                Removes the pen
go to x:()y:(         Moves to the center of the circle
turn cw(120)degrees   Rotates around the center
move(2)steps          Moves 2 pixels out in a certain direction
pen down              Applies the pen
set[S v]to(20         Sets the size of the stars to 20 pixels
repeat(9              Loops code so that 9 nesting pentagrams are drawn, essentially filling in the stars
change[S v]by(-2      Decrements the size of the next pentagram
turn cw(18)degrees      Moves the starting position
move(1)steps            of the pentagram to adjust
turn ccw(18)degrees     for the smaller size
repeat(5              Loops code for each edge of a pentagram
move(S)steps          Draws an edge of the appropriate length
turn cw(144)degrees   Rotates the edge to be drawn an appropriate amount

     Note that an "end" line is not needed if a "c-block" is at the end of a script

```
> 4 votes

# Answer
## PHP, 288 bytes

```
<?php
echo gzuncompress(base64_decode("eJyNjssKgzAQRX9loIupi9DM+GgF47+IJiagtcT08fnVYMFCF90Mc+Hcw63mR19XXrcBnq4LViEzo9Wut0EhZRkaNwwKD62UeNrI10rluBUo/8VLLla+h+Cb62wmPyqM79AEfSQiOHPygY0xWFet8+2gwStMy7W7ywXCt/fWBAuuW5wIyx0FExCU4gKLuRC5oJgEMVBMIgXiGCOxOu6zBuu1WawBdzP9FOJGlskfGGcRewOZ3F4l"))?>

```

Unpacks and echos the following inline svg image that abuses the browser's handling of both the HTML and SVG standards (newlines added for readability):

```
<svg>
<rect width='222'height='144'fill='#c00'/>
<rect x='225'width='15'height='144'fill='#026'/>
<g transform='translate(111 72)'fill='#fff'>
<circle r='39'/>
<circle r='36' fill='#026'/>
<path id='t' d='m-21 1 9-8 11 6-5-11 9-8-12 1-5-11-3 12-12 1 11 6'/>
<use href='#t'transform='rotate(120)'/>
<use href='#t'transform='rotate(240)'/>

```

Tested under Chrome and Firefox.

Try it on phpfiddle.org
> 3 votes

# Answer
# Java + Processing, 441 bytes

```
void star(float x,float y,float r1,float r2){float t=TWO_PI/5;beginShape();for(float a=0;a<TWO_PI;a+=t){vertex(x+cos(a)*r2,y+sin(a)*r2);vertex(x+cos(a+t/2.0)*r1,y+sin(a+t/2.0)*r1);}endShape();}void setup(){size(166,100);background(#cc0000);stroke(255);fill(#002d65);strokeWeight(2.1);circle(77,50,50);rect(154,-3,13,103);noStroke();fill(255);for(int i=0;i<3;i++){pushMatrix();translate(77,50);rotate(i*2*PI/3);star(-5,12,4,11);popMatrix();}}

```

5 pointed star function modified from Processing examples.
> 2 votes

# Answer
## Python+PIL, 485 bytes

```
from math import*;from PIL import Image,ImageDraw
_=255
w,B,W,l,a=(_,_,_),(0,45,101),425,393,1.85
I=Image.new('RGB',(W,_))
d=ImageDraw.Draw(I)
t=d.rectangle
t([0,0,W,_],(_,0,0));t([l,0,W,_],B);t([l,0,398,_],w)
x,y,e,f=193,127,64,'d.ellipse([(x-e,y-e),(x+e,y+e)],%s)'
exec(f%'w'+';e-=4;'+f%'B')
def S(x,y,R):p,a,v,r=[],pi/5,2.65,29;exec('R+=2*a;p+=[(x+cos(R)*r,y+sin(R)*r),x+cos(R+a)*r/v,y+sin(R+a)*r/v];'*5);d.polygon(p,w)
exec('S(193+cos(a)*32,127+sin(a)*32,a-1.85);a+=2;'*3)
I.save('img.png')

```
> 1 votes

# Answer
# SVG, 260 bytes

Not very cross browser friendly, renders correctly in Firefox.

```
<svg viewBox=-35,-24,80,48 style=background:red><g fill=blue stroke=#fff><circle r=12.5 /><path d=M39.5,-44v99h99 /><g fill=#fff stroke=blue stroke-width=.2><text x=-10>★</text><text x=-10 transform=rotate(120)>★</text><text x=-10 transform=rotate(240)>★
```
> 1 votes

---
Tags: code-golf, kolmogorov-complexity, graphical-output
---


title: The World's Smallest Web Browser

text:
# Question
Title: The World's Smallest Web Browser
**Backstory:**

> You enjoy your new programming job at a mega-multi-corporation. However, you aren't allowed to browse the web since your computer only has a CLI. They also run sweeps of all employees' hard drives, so you can't simply download a large CLI web browser. You decide to make a simple textual browser that is as small as possible so you can memorize it and type it into a temporary file every day.

**Challenge:**

Your task is to create a golfed web browser within a command-line interface. It should:

* Take a single URL in via args or stdin
* Split the `directory` and `host` components of the URL
* Send a simple HTTP request to the `host` to request the said `directory`
* Print the contents of any `<p>` paragraph `</p>` tags
* And either exit or ask for another page

**More Info:**

A simple HTTP request looks like this:

```
GET {{path}} HTTP/1.1
Host: {{host}}
Connection: close
\n\n

```

Ending newlines emphasized.

A typical response looks like:

```
HTTP/1.1 200 OK\n
<some headers separated by newlines>
\n\n
<html>
....rest of page

```

**Rules:**

* It only needs to work on port 80 (no SSL needed)
* You may not use netcat
* **Whatever programming language is used, only low-level TCP APIs are allowed (except netcat)**
* You may **not** use GUI, remember, it's a CLI
* You may not use HTML parsers, except builtin ones (BeautifulSoup is not a builtin)
* **Bonus!!** If your program loops back and asks for another URL instead of exiting, -40 chars (as long as you don't use recursion)
* No third-party programs. Remember, you can't install anything.
* , so the shortest byte count wins

# Answer
> 69 votes
# Pure Bash (no utilities), 200 bytes - 40 bonus = 160

```
while read u;do
u=${u#*//}
d=${u%%/*}
exec 3<>/dev/tcp/$d/80
echo "GET /${u#*/} HTTP/1.1
host:$d
Connection:close
">&3
mapfile -tu3 A
a=${A[@]}
a=${a#*<p>}
a=${a%</p>*}
echo "${a//<\/p>*<p>/"
"}"
done

```

I think this is up to the spec, though of course watch out for parsing HTML using regex I think the only thing worse than parsing HTML using regex is parsing HTML using shell pattern matching.

This now deals with `<p>...</p>` spanning multiple lines. Each `<p>...</p>` is on a separate line of output:

```
$ echo "http://example.com/" | ./smallbrowse.sh
This domain is established to be used for illustrative examples in documents. You may use this     domain in examples without prior coordination or asking for permission.
<a href="http://www.iana.org/domains/example">More information...</a>
$

```

# Answer
> 22 votes
# PHP, 175 bytes (215 - 40 bonus) ~~227~~ ~~229~~ ~~239~~ ~~202~~ ~~216~~ ~~186~~ bytes

Have fun browsing the web:

```
for(;$i=parse_url(trim(fgets(STDIN))),fwrite($f=fsockopen($h=$i[host],80),"GET $i[path] HTTP/1.1
Host:$h
Connection:Close

");preg_match_all('!<p>(.+?)</p>!si',stream_get_contents($f),$r),print join("
",$r[1])."
");

```

Reads URLs from `STDIN` like `http://www.example.com/`. Outputs paragraphs separated by newline "`\n`".

---

**Ungolfed**

```
for(; $i=parse_url(trim(fgets(STDIN))); ) {
    $h = $i['host'];
    $f = fsockopen($h, 80);

    fwrite($f, "GET " . $i['path'] . " HTTP/1.1\nHost:" . $h . "\nConnection:Close\n\n");

    $c = stream_get_contents($f)

    preg_match_all('!<p>(.+?)</p>!si', $c, $r);
    echo join("\n", $r[1]) . "\n";
}

```

---

**First version supporting one URL only**

```
$i=parse_url($argv[1]);fwrite($f=fsockopen($h=$i[host],80),"GET $i[path] HTTP/1.1\nHost:$h\nConnection:Close\n\n");while(!feof($f))$c.=fgets($f);preg_match_all('!<p>(.+?)</p>!sim',$c,$r);foreach($r[1]as$p)echo"$p\n";

```

---

---

**Edits**

* As pointed out in the comments by Braintist, I totally forgot to include the path. That's fixed now, thanks. *Added* **30 bytes**.
* *Saved* **3 bytes** by resetting `$c` (holds the page content) with `$c=$i=parse_url(trim(fgets(STDIN)));` instead of `$c=''`.
* *Saved* **12 bytes** by replacing `\n` with new lines (5 bytes), one `while`-loop with `for` (2 bytes), placing nearly everything into the expressions of `for` (2 bytes) and by replacing `foreach` with `join` (3 bytes). Thanks to Blackhole.
* *Saved* **3 bytes** by replacing `fgets` with `stream_get_contents` Thanks to bwoebi.
* *Saved* **5 bytes** by removing ~~the re-initialization of `$c` as it isn't needed anymore~~ `$c` at all.
* *Saved* **1 byte** by removing the pattern modifier `m` from the Regex. Thanks to manatwork

# Answer
> 16 votes
## Perl, 132 bytes

**155 bytes code + 17 for `-ln -MIO::Socket` \- 40 for continually asking for URLs**

As with @DigitalTrauma's answer, regex parsing HTML, let me know if that's not acceptable. Doesn't keep parsing URLs any more... I'll look at that later... Close to Bash though! Big thanks to @Schwern for saving me 59 (!) bytes and to @skmrx for fixing the bug to allow a claim of the bonus!

```
m|(http://)?([^/]+)(/(\S*))?|;$s=new IO::Socket::INET"$2:80";print$s "GET /$4 HTTP/1.1
Host:$2
Connection:close

";local$/=$,;print<$s>=~m|<p>(.+?)</p>|gs

```

### Usage

```
$perl -ln -MIO::Socket -M5.010 wb.pl
example.com
This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.<a href="http://www.iana.org/domains/example">More information...</a>
example.org
This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.<a href="http://www.iana.org/domains/example">More information...</a>

```

# Answer
> 14 votes
# PowerShell, ~~315 294 268 262~~ 254 bytes

### ~~355 334 308 302~~ 294 - 40 for prompt

```
$u=[uri]$args[0]
for(){
$h=$u.Host
$s=[Net.Sockets.TcpClient]::new($h,80).GetStream()
$r=[IO.StreamReader]::new($s)
$w=[IO.StreamWriter]::new($s)
$w.Write("GET $($u.PathAndQuery) HTTP/1.1
HOST: $h

")
$w.Flush()
($r.ReadToEnd()|sls '(?s)(?<=<p>).+?(?=</p>)'-a).Matches.Value
[uri]$u=Read-Host
}

```

**Requires PowerShell v5**

All line endings (including the ones embedded in the string) are newlines only `\n` (thanks Blackhole) which is fully supported by PowerShell (but if you're testing, be careful; ISE uses `\r\n`).

# Answer
> 9 votes
Bash (might be cheating but seems to be within rules) 144-40=105

```
while read a;do
u=${a#*//}
d=${u%%/*}
e=www.w3.org
exec 3<>/dev/tcp/$d/80
echo "GET /services/html2txt?url=$a HTTP/1.1
Host:$d
">&3
cat <&3
done

```

Thanks to Digital Trauma.

Since I don't need to split URL, this also works: 122-40=82

```
while read a;do
d=www.w3.org
exec 3<>/dev/tcp/$d/80
echo "GET /services/html2txt?url=$a HTTP/1.1
Host:$d
">&3
cat <&3
done

```

# Answer
> 9 votes
# Groovy script, ~~89~~, 61 bytes

Loop back for bonus 101- **40** = 61

```
System.in.eachLine{l->l.toURL().text.findAll(/<p>(?s)(.*?)<\/p>/).each{println it[3..it.length()-5]}}

```

With just args, **89** bytes

```
this.args[0].toURL().text.findAll(/<p>(?s)(.*?)<\/p>/).each{println it[3..it.length()-5]}

```

# Answer
> 7 votes
## Ruby, 118

147 bytes source; 11 bytes '`-lprsocket`'; -40 bytes for looping.

```
*_,h,p=$_.split'/',4
$_=(TCPSocket.new(h,80)<<"GET /#{p} HTTP/1.1
Host:#{h}
Connection:close

").read.gsub(/((\A|<\/p>).*?)?(<p>|\Z)/mi,'
').strip

```

### Usage example:

```
$ ruby -lprsocket wb.rb
http://example.org/
This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.
<a href="http://www.iana.org/domains/example">More information...</a>
http://www.xkcd.com/1596/
Warning: this comic occasionally contains strong language (which may be unsuitable for children), unusual humor (which may be unsuitable for adults), and advanced mathematics (which may be unsuitable for liberal-arts majors).

This work is licensed under a
<a href="http://creativecommons.org/licenses/by-nc/2.5/">Creative Commons Attribution-NonCommercial 2.5 License</a>.

This means you're free to copy and share these comics (but not to sell them). <a rel="license" href="/license.html">More details</a>.

```

# Answer
> 6 votes
## C 512 Bytes

```
#include <netdb.h>
int main(){char i,S[999],b[99],*p,s=socket(2,1,0),*m[]={"<p>","</p>"};long n;
gets(S);p=strchr(S,'/');*p++=0;struct sockaddr_in a={0,2,5<<12};memcpy(&a.
sin_addr,gethostbyname(S)->h_addr,4);connect(s,&a,16);send(s,b,sprintf(b,
"GET /%s HTTP/1.0\r\nHost:%s\r\nAccept:*/*\r\nConnection:close\r\n\r\n",p,S),0);
p=m[i=0];while((n=recv(s,b,98,0))>0)for(char*c=b;c<b+n;c++){while(*c==*p &&*++p)
c++;if(!*p)p=m[(i=!i)||puts("")];else{while(p>m[i]){if(i)putchar(c[m[i]-p]);p--;}
if(i)putchar(*c);}}}

```

Based loosely on my entry here, It takes the web address without a leading "https://". It will not handle nested `<p>` pairs correctly :(

Tested extensively on `www.w3.org/People/Berners-Lee/`
It works when compiled with `Apple LLVM version 6.1.0 (clang-602.0.53) / Target: x86_64-apple-darwin14.1.1`
It has enough undefined behavior that it may not work anywhere else.

# Answer
> 5 votes
# AutoIt, 347 bytes

```
Func _($0)
$4=StringTrimLeft
$0=$4($0,7)
$3=StringSplit($0,"/")[1]
TCPStartup()
$2=TCPConnect(TCPNameToIP($3),80)
TCPSend($2,'GET /'&$4($0,StringLen($3))&' HTTP/1.1'&@LF&'Host: '&$3&@LF&'Connection: close'&@LF&@LF)
$1=''
Do
$1&=TCPRecv($2,1)
Until @extended
For $5 In StringRegExp($1,"(?s)\Q<p>\E(.*?)(?=\Q</p>\E)",3)
ConsoleWrite($5)
Next
EndFunc

```

### Testing

Input:

```
_('http://www.autoitscript.com')

```

Output:

```
You don't have permission to access /error/noindex.html
on this server.

```

Input:

```
_('http://www.autoitscript.com/site')

```

Output:

```
The document has moved <a href="https://www.autoitscript.com/site">here</a>.

```

### Remarks

* Doesn't support nested `<p>` tags
* Supports only `<p>` tags (case-insensitive), will break on every other tag format
* ~~Panics~~ Loops indefinitely when any error occurs

# Answer
> 5 votes
# C#, 727 Bytes - 40 = 687 Bytes

```
using System.Text.RegularExpressions;class P{static void Main(){a:var i=System.Console.ReadLine();if(i.StartsWith("http://"))i=i.Substring(7);string p="/",h=i;var l=i.IndexOf(p);
if(l>0){h=i.Substring(0,l);p=i.Substring(l,i.Length-l);}var c=new System.Net.Sockets.TcpClient(h,80);var e=System.Text.Encoding.ASCII;var d=e.GetBytes("GET "+p+@" HTTP/1.1
Host: "+h+@"
Connection: close

");var s=c.GetStream();s.Write(d,0,d.Length);byte[]b=new byte[256],o;var m=new System.IO.MemoryStream();while(true){var r=s.Read(b,0,b.Length);if(r<=0){o=m.ToArray();break;}m.Write(b,0,r);}foreach (Match x in new Regex("<p>(.+?)</p>",RegexOptions.Singleline).Matches(e.GetString(o)))System.Console.WriteLine(x.Groups[1].Value);goto a;}}

```

It's a little bit of training but surely memorable :)

Here is an ungolfed version:

```
using System.Text.RegularExpressions;
class P
{
    static void Main()
    {
    a:
        var input = System.Console.ReadLine();
        if (input.StartsWith("http://")) input = input.Substring(7);
        string path = "/", hostname = input;
        var firstSlashIndex = input.IndexOf(path);
        if (firstSlashIndex > 0)
        {
            hostname = input.Substring(0, firstSlashIndex);
            path = input.Substring(firstSlashIndex, input.Length - firstSlashIndex);
        }
        var tcpClient = new System.Net.Sockets.TcpClient(hostname, 80);
        var asciiEncoding = System.Text.Encoding.ASCII;
        var dataToSend = asciiEncoding.GetBytes("GET " + path + @" HTTP/1.1
Host: " + hostname + @"
Connection: close

");
        var stream = tcpClient.GetStream();
        stream.Write(dataToSend, 0, dataToSend.Length);
        byte[] buff = new byte[256], output;
        var ms = new System.IO.MemoryStream();
        while (true)
        {
            var numberOfBytesRead = stream.Read(buff, 0, buff.Length);
            if (numberOfBytesRead <= 0)
            {
                output = ms.ToArray();
                break;
            }
            ms.Write(buff, 0, numberOfBytesRead);
        }
        foreach (Match match in new Regex("<p>(.+?)</p>", RegexOptions.Singleline).Matches(asciiEncoding.GetString(output)))
        {
            System.Console.WriteLine(match.Groups[1].Value);
            goto a;
        }
    }
}

```

As you can see, there are memory leak issues as a bonus :)

# Answer
> 4 votes
## JavaScript (NodeJS) - ~~187~~ 166

```
s=require("net").connect(80,p=process.argv[2],_=>s.write("GET / HTTP/1.0\nHost: "+p+"\n\n")&s.on("data",d=>(d+"").replace(/<p>([^]+?)<\/p>/g,(_,g)=>console.log(g))));

```

187:

```
s=require("net").connect(80,p=process.argv[2],_=>s.write("GET / HTTP/1.1\nHost: "+p+"\nConnection: close\n\n")&s.on("data",d=>(d+"").replace(/<p>([^]+?)<\/p>/gm,(_,g)=>console.log(g))));

```

Usage:

```
node file.js www.example.com

```

Or formatted

```
var url = process.argv[2];
s=require("net").connect(80, url ,_=> {
     s.write("GET / HTTP/1.1\nHost: "+url+"\nConnection: close\n\n");
     s.on("data",d=>(d+"").replace(/<p>([^]+?)<\/p>/gm,(_,g)=>console.log(g)))
});

```

# Answer
> 3 votes
# Python 2 - ~~212~~ 209 bytes

```
import socket,re
h,_,d=raw_input().partition('/')
s=socket.create_connection((h,80))
s.sendall('GET /%s HTTP/1.1\nHost:%s\n\n'%(d,h))
p=''
while h:h=s.recv(9);p+=h
for g in re.findall('<p>(.*?)</p>',p):print g

```

# Answer
> 3 votes
# Python 2, 187 - 40 = 147 (141 in a REPL)

Compressed and looped version of Zac's answer:

```
import socket,re
while 1:h,_,d=raw_input().partition('/');s=socket.create_connection((h,80));s.sendall('GET /%s HTTP/1.1\nHost:%s\n\n'%(d,h));print re.findall('<p>(.*?)</p>',s.recv(9000))

```

Example:

```
dictionary.com
['The document has moved <a href="http://dictionary.reference.com/">here</a>.']
dictionary.reference.com
[]
paragraph.com
[]
rare.com
[]

```

Actually useful is this:

# 207 - 40 = 167

```
import socket,re
while 1:h,_,d=raw_input().partition('/');s=socket.create_connection((h,80));s.sendall('GET /%s HTTP/1.1\nHost:%s\n\n'%(d,h));print'\n'.join(re.findall('<p>(.*?)</p>',s.recv(9000),re.DOTALL))

```

Example:

```
example.org
This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.
<a href="http://www.iana.org/domains/example">More information...</a>
www.iana.org/domains/example
The document has moved <a href="/domains/reserved">here</a>.
www.iana.org/domains/reserved

dictionary.com
The document has moved <a href="http://dictionary.reference.com/">here</a>.
dictionary.reference.com

catb.org

      <a href="http://validator.w3.org/check/referer"><img
          src="http://www.w3.org/Icons/valid-xhtml10"
          alt="Valid XHTML 1.0!" height="31" width="88" /></a>

This is catb.org, named after (the) Cathedral and the Bazaar. Most
of it, under directory esr, is my personal site.  In theory other
people could shelter here as well, but this has yet to occur.
catb.org/jargon
The document has moved <a href="http://www.catb.org/jargon/">here</a>.
www.catb.org/jargon/
This page indexes all the WWW resources associated with the Jargon File
and its print version, <cite>The New Hacker's Dictionary</cite>. It's as
official as anything associated with the Jargon File gets.
On 23 October 2003, the Jargon File achieved the
dubious honor of being cited in the SCO-vs.-IBM lawsuit.  See the <a
href='html/F/FUD.html'>FUD</a> entry for details.
www.catb.org/jargon/html/F/FUD.html
 Defined by Gene Amdahl after he left IBM to found his own company:
   “<span class="quote">FUD is the fear, uncertainty, and doubt that IBM sales people
   instill in the minds of potential customers who might be considering
   [Amdahl] products.</span>” The idea, of course, was to persuade them to go
   with safe IBM gear rather than with competitors' equipment.  This implicit
   coercion was traditionally accomplished by promising that Good Things would
   happen to people who stuck with IBM, but Dark Shadows loomed over the
   future of competitors' equipment or software.  See
   <a href="../I/IBM.html"><i class="glossterm">IBM</i></a>.  After 1990 the term FUD was associated
   increasingly frequently with <a href="../M/Microsoft.html"><i class="glossterm">Microsoft</i></a>, and has
   become generalized to refer to any kind of disinformation used as a
   competitive weapon.
[In 2003, SCO sued IBM in an action which, among other things,
   alleged SCO's proprietary control of <a href="../L/Linux.html"><i class="glossterm">Linux</i></a>.  The SCO
   suit rapidly became infamous for the number and magnitude of falsehoods
   alleged in SCO's filings.  In October 2003, SCO's lawyers filed a <a href="http://www.groklaw.net/article.php?story=20031024191141102" target="_top">memorandum</a>
   in which they actually had the temerity to link to the web version of
   <span class="emphasis"><em>this entry</em></span> in furtherance of their claims. Whilst we
   appreciate the compliment of being treated as an authority, we can return
   it only by observing that SCO has become a nest of liars and thieves
   compared to which IBM at its historic worst looked positively
   angelic. Any judge or law clerk reading this should surf through to
   <a href="http://www.catb.org/~esr/sco.html" target="_top">my collected resources</a> on this
   topic for the appalling details.—ESR]

```

# Answer
> 2 votes
# gawk, 235 - 40 = 195 bytes

```
{for(print"GET "substr($0,j)" HTTP/1.1\nHost:"h"\n"|&(x="/inet/tcp/0/"(h=substr($0,1,(j=index($0,"/"))-1))"/80");(x|&getline)>0;)w=w RS$0
for(;o=index(w,"<p>");w=substr(w,c))print substr(w=substr(w,o+3),1,c=index(w,"/p>")-2)
close(x)}

```

Golfed it down, but this is a more unforgiving version, which needs the web address without `http://` at the beginning. And if you want to access the root directory you have to end the address with a `/`. Furthermore the `<p>` tags have to be lower case.

My earlier version actually didn't handle lines containing `</p><p>` correctly. This is now fixed.

### Output for input `example.com/`

```
This domain is established to be used for illustrative examples in documents. You may use this
    domain in examples without prior coordination or asking for permission.
<a href="http://www.iana.org/domains/example">More information...</a>

```

Still doesn't work with Wikipedia. I think the reason is that Wikipedia uses `https` for everything. But I don't know.

The following version is a little more forgiving with the input and it can handle upper case tags as well.

```
IGNORECASE=1{
    s=substr($0,(i=index($0,"//"))?i+2:0)
    x="/inet/tcp/0/"(h=(j=index(s,"/"))?substr(s,1,j-1):s)"/80"
    print"GET "substr(s,j)" HTTP/1.1\nHost:"h"\nConnection:close\n"|&x
    while((x|&getline)>0)w=w RS$0
    for(;o=index(w,"<p>");w=substr(w,c))
        print substr(w=substr(w,o+3),1,c=index(w,"/p>")-2)
    close(x)
}

```

I'm not sure about the `"Connection:close"` line. Doesn't seem to be mandatory. I couldn't find an example that would work different with or without it.

# Answer
> 1 votes
**Powershell(4) 240**

```
$input=Read-Host ""
$url=[uri]$input
$dir=$url.LocalPath
Do{
$res=Invoke-WebRequest -URI($url.Host+"/"+$dir) -Method Get
$res.ParsedHtml.getElementsByTagName('p')|foreach-object{write-host $_.innerText}
$dir=Read-Host ""
}While($dir -NE "")

```

Ungolfed (proxy is not required)

```
$system_proxyUri=Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name ProxyServer
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxyUri = $proxy.GetProxy($system_proxyUri.ProxyServer)
$input = Read-Host "Initial url"
#$input="http://stackoverflow.com/questions/tagged/powershell"
$url=[uri]$input
$dir=$url.LocalPath
Do{
$res=Invoke-WebRequest -URI($url.Host+"/"+$dir) -Method Get -Proxy($proxyUri)
$res.ParsedHtml.getElementsByTagName('p')|foreach-object{write-host $_.innerText}
$dir=Read-Host "next dir"
}While($dir -NE "")

```

edit\* also not to hard to memorize ^^

# Answer
> 1 votes
# Java (OpenJDK 15), 790 bytes - 40 bytes = 750 bytes

```
import java.io.*;import java.net.*;import java.util.*;import java.util.regex.*;interface A{static void main(String[]a)throws IOException{Pattern p=Pattern.compile("<p(.*?)>(.*?)</p>",Pattern.DOTALL);Matcher m;while(true){URL u=new URL(new Scanner(System.in).nextLine());Socket s=new Socket(u.getHost(),80);PrintStream ps=new PrintStream(s.getOutputStream());BufferedReader b=new BufferedReader(new InputStreamReader(s.getInputStream()));ps.print("GET "+(u.getPath().length()==0?"/":u.getPath())+" HTTP/1.1\r\nHost: "+u.getHost()+"\r\nConnection: close\r\n\r\n");var l=b.readLine();var r=new StringBuilder();while(l!=null){l=b.readLine();r.append(l).append("\n");}m=p.matcher(r);while(m.find()){System.out.println(m.group().replaceAll("<p(.*?)>|</p>",""));}ps.close();b.close();s.close();}}}

```

Ungolfed version:

```
package rocks.sech1p;

import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner input = new Scanner(System.in);
        Pattern pattern = Pattern.compile("<p(.*?)>(.*?)</p>", Pattern.DOTALL);
        Matcher match;

        while(true) {
            URL url = new URL(input.nextLine());
            Socket socket = new Socket(url.getHost(), 80);
            PrintStream printstream = new PrintStream(socket.getOutputStream());
            BufferedReader buffer = new BufferedReader(new InputStreamReader(socket.getInputStream()));

            printstream.print("GET " + (url.getPath().length() == 0 ? "/" : url.getPath()) + " HTTP/1.1\r\nHost: " + url.getHost() + "\r\nConnection: close\r\n\r\n");

            String line = buffer.readLine();
            StringBuilder response = new StringBuilder();
            while (line != null) {
                line = buffer.readLine();
                response.append(line).append("\n");
            }
            match = pattern.matcher(response);
            while(match.find())
                System.out.println(match.group().replaceAll("<p(.*?)>|</p>", ""));

            printstream.close();
            buffer.close();
            socket.close();
        }
    }
}

```

---
Tags: code-golf, parsing, internet
---


title: Sum over an Interval

text:
# Question
Title: Sum over an Interval
Inspired by this challenge, and similar to this and this.

After seeing these, I figured I would continue the trend as there was no inclusive/exclusive sum. The goal here is to sum an interval of integers, either inclusive and exclusive, and output the total to stdout.

Input format: either a `(` or `[` followed by 2 comma separated integers followed by a `)` or `]`. Ex: `[a, b]` `(a, b]` `[a, b)` `(a, b)`

* Note: `b > a >= 0` and the range will always contain at least 1 value.
* Input regex: `[\(\[]\d+,\d+[\)\]]`

Examples:

```
Input -> Output

[2,6] -> 20
(15,25] -> 205
[0,16) -> 120
(15,20) -> 70
[1,2) -> 1
(2,12] -> 75
[11,16] -> 81
(15,29) -> 286
[14,15) -> 14
(2,16] -> 133
(12,18) -> 75

```

This is code-golf, so the shortest code in bytes wins.

# Answer
> 6 votes
# Jelly, 14 bytes

```
ḊṖVr/ḟ×ɗċⱮØ($S

```

A monadic Link accepting a list of characters that yields the sum of the described range.

**Try it online!** Or see the test-suite.

### How?

```
ḊṖVr/ḟ×ɗċⱮØ($S - Link: list of characters, R  e.g. "[5,8)"
Ḋ              - dequeue                           "5,8)"
 Ṗ             - pop                               "5,8"
  V            - evaluate as Jelly                 [5,8]
                 (call that X)
            $  - last two links as a monad - f(R):
          Ø(   -   list of characters = "()"       "()"
         Ɱ     -   map across these with:
        ċ      -     count ocuurences (in R)       [0,1]
                     (call that Y)
       ɗ       - last three links as a dyad - f(X,Y):
    /          -   reduce (X) with:
   r           -     inclusive range               [5,6,7,8]
      ×        -   (X) multiply (Y) (vectorises)   [0,8]
     ḟ         -   filter discard                  [5,6,7]
             S - sum                               18

```

# Answer
> 5 votes
# Jelly, 16 bytes

```
ṙ1“(Ḋ)Ṗ,r”yḟØ[VS

```

Try it online!

Very similar to my answer to the related challenge

## How it works

```
ṙ1“(Ḋ)Ṗ,r”yḟØ[VS - Main link. Takes a string S on the left
ṙ1               - Rotate the first character of S to the end
  “(Ḋ)Ṗ,r”       - String literal "(Ḋ)Ṗ,r"
          y      - Translate S according to this string
                    This splits the string into pairs of characters [["(", "Ḋ"], [")", "Ṗ"], [",", "r"]]
                    then for each pair, replaces all occurrences of the first character
                    with the second character e.g. ( -> Ḋ; ) -> Ṗ; , -> r
           ḟØ[   - Remove all square brackets
              V  - Evaluate as Jelly
               S - Sum

```

### Why `r`,  and ?

Consider the four possible examples with `[`, `]`, `(` and `)`:

```
[2,6] -> 2,6][ -> 2r6
[2,6) -> 2,6)[ -> 2r6Ṗ
(2,6] -> 2,6]( -> 2r6Ḋ
(2,6) -> 2,6)( -> 2r6ṖḊ

```

The first step is rotating the string and the second step is translating and filtering.

`r` takes a number on the left and a number of the right and yields an inclusive range between them
takes a list and ops the last element off. `rṖ` is a right-exclusive range
takes a list and equeues it, removing the first element. `rḊ` is a left-exclusive range

Therefore, `rṖḊ` is a fully exclusive range

# Answer
> 5 votes
# Python 3, 67 bytes

```
lambda s:sum(eval("range"+s.translate({91:"(",40:"(1+",93:"+1)"})))

```

Try it online!

# Answer
> 5 votes
# JavaScript (ES6),  ~~66 ... 60~~  56 bytes

*Saved 3 bytes by borrowing `split(/\b/)` from Redwolf Programs' answer*

```
s=>([,x,c,y,p]=s.split(/\b/),(y-=p<c,x-=s>c)-y)*~(x+y)/2

```

Try it online!

### How?

We extract the comma as `c` along with the other substrings so that it can be used to distinguish between parentheses and brackets.

The sum of the range \\$\[x..y\]\\$ is obtained with:

$$\frac{(y-x+1)(x+y)}{2}$$

implemented as:

```
((x - 1) - y) * ~((x - 1) + y) / 2

```

(Because `x` is a string, we do `x -= s > c` instead of `x += s < c` to force the coercion to a number at no cost. That's why \\$x\\$ is off by \\$1\\$ in the JS code.)

# Answer
> 4 votes
# JavaScript (V8), 104 bytes

```
n=>[...Array(+(p=n.split(/\b/))[3]+(p[4]>"[")).keys(n=0)].filter(i=>i>=+p[1]+(p[0]<")")).map(i=>n+=i)&&n

```

Try it online!

# Answer
> 4 votes
# , 30 bytes

```
1#.[:-.&i./']('&e.+3 1".&>@{;:

```

Try it online!

Explained using `(2,12]` as an example:

* `;:` Chop into words:

```
┌─┬─┬─┬──┬─┐
│(│2│,│12│]│
└─┴─┴─┴──┴─┘

```
* `3 1".&>@{` Pluck the 3rd and 1st elements, and convert them to ints:

```
12 2

```
* `']('&e.` Are `](` elements of the input? Returns boolean list:

```
1 1

```
* `+` Add the results of the previous 2 steps. This does the endpoint "adjustment" we'll need for the final step:

```
13 3

```
* `[:-.&i./` Convert each of the above numbers to lists `0..<n-1>`, and then set subtract. That is:

```
                             v set minus
0 1 2 3 4 5 6 7 8 9 10 11 12 -. 0 1 2
3 4 5 6 7 8 9 10 11 12

```
* `1#.` Sum

```
75

```

# Answer
> 3 votes
# Python 3, ~~105~~ 88 bytes

```
def f(s):c,d=map(int,s[1:-1].split(','));return sum(range(c+(s[0]=="("),d+(s[-1]!=")")))

```

Ungolfed:

```
def sumOverRange(s):
    a = s[0]=="("
    b = s[-1]!=")"
    c, d = map(int, s[1:-1].split(','))
    return sum(range(c+a,d+b))

```

# Answer
> 3 votes
# Python 3.6+, 57 bytes

```
lambda x:eval(f"sum(range({x<'['}+{x[1:-1]}+{']'in x}))")

```

An unnamed function accepting a string, `x`, that returns the sum of the range described.

**Try it online!**

### How?

Evaluates code made with an f-string with the following three evaluated parts (as they are enclosed in `{}`s):

```
x<'[' - does x start with a character before ']'?
        ...effectively: does x start with a '('? -> True / False

x[1:-1] - x without its brackets

']'in x - does x contain a ']'?
          ...effectively: does x end with a ']' -> True / False

```

For example for `x="(5,9)"` the string will be:

```
sum(range(True+5,9+False))

```

In Python `True` and `False` are equivalent to `1` and `0` respectively, while the `range(a,b)` function is \\$\[a,b)\\$ so `range(True+5,9+False)` is \\$\[1+5,9+0)=\[6,9)\\$ and evaluation sums this giving \\$21\\$.

# Answer
> 3 votes
# Add++, 40 bytes

```
L,BPBp","$t€v-1A:")"=0$_0A:"("=b[z£+¦rb+

```

Try it online!

Add++ ain't great at golfing, but it's surprisingly not awful here

## How it works

```
L,		; Define a lambda that takes a string S
	BPBp	; Remove the first and last characters of S
	","$t	; Split on ","
	€v	; Evaluate each; Call this R
	-1A:	; Get the last character of S
	")"=	; Is it equal to ")"?
	0$_	; Negate
	0A:"("=	; Is the first character of S "("?
	b[	; Pair
	z£+	; Add to R
	¦r	; Range
	b+	; Sum

```

# Answer
> 3 votes
# Charcoal, 24 bytes

```
Ｆ⮌⪪Ｓ,⊞υ⁺Σι∨№ι(№ι]ＩΣ…⊟υ⊟υ

```

Try it online! Link is to verbose version of code. Explanation:

```
Ｆ⮌⪪Ｓ,

```

Split the input on `,` and loop over the parts (in reverse order, so that I can pop them off with one-byte instructions).

```
⊞υ⁺Σι∨№ι(№ι]

```

Extract the integer part from the string but increment it if the string contains a `(` or a `]`. This converts the range into the `[..)` form.

```
ＩΣ…⊟υ⊟υ

```

Create the range and take the sum.

# Answer
> 2 votes
# Scala, 89 bytes

```
{case s"$a,$b"=>val(c,d)=a.tail.toInt->b.init.toInt;d*(d-1+b.last/42)-c*(c+1-a(0)/42)>>1}

```

Try it in Scastie!

Looks like math didn't win this time, although this answer is also long because parsing isn't too straightforward.

This uses the formula \\$\frac{d(d-1+j)-c(c+1-i)}{2}\\$, where \\$c\\$ is the first number, \\$d\\$ is the second number, \\$i\\$ is 2 if the start is closed and 0 otherwise, and \\$j\\$ is 2 if the end is closed and 0 otherwise.

Since the characters `[` and `]` are 91 and 93 in ASCII, respectively, when divided by 42, they become 2. The characters `(` and `)` are 40 and 41, so they become 0.

```
{case s"$a,$b" =>  //a is the part before the comma, b is the part after (including brackets)
val (c, d) = a.tail.toInt -> b.init.toInt; //c is the first number, d is the second
d*(d-1+b.last/42)  //d(d - 1 + j)
-c*(c+1-a(0)/42)   //- c(c + 1 - i)
>>1}               //divided by 2 (for operator precedence reasons)

```

# Answer
> 2 votes
# C (gcc), ~~82~~ ~~80~~ 79 bytes

Saved ~~2~~ 3 bytes thanks to ceilingcat!!!

```
a;b;c;f(char*s){sscanf(s+1,"%d,%d%c",&a,&b,&c);a-=*s&1;b-=c<42;b=a*~a-b*~b>>1;}

```

Try it online!

# Answer
> 2 votes
# Retina 0.8.2, 36 bytes

```
\d+
$*
[](]
1
M&!`(?<=(1*),1+)1*\1
1

```

Try it online! Link includes test cases. Explanation:

```
\d+
$*

```

Convert to unary.

```
[](]
1

```

Add 1 to ranges beginning `(` or ending `]`, so that the range is now of the form `[..)`.

```
M&!`(?<=(1*),1+)1*\1

```

List all of the integers in the range.

```
1

```

Sum them and convert to decimal.

# Answer
> 2 votes
# Vyxal, `s`, 22 bytes

```
ḢṪ⌐:h⌊⁰h\(=+^t⌊⁰t\)=-ṡ

```

Try it Online!

I don't really know Vyxal so I suppose this can be golfed more. But the idea here is to get both the numbers and take sum of all integers between them. If the first character is `(`, then increase the first number by 1, and if the last character is `)`, then decrease the second number by 1.

```
ḢṪ⌐     # Remove first and last characters, then split by ","
:       # Duplicate
h⌊      # Take first element and convert to integer
⁰h\(=+  # Add 1 if the first character of input is equal to "("
^       # Reverse stack
t⌊      # Get last element and convert to integer
⁰t\)=-  # Subtract 1 if the last character of input is equal to ")"
ṡ       # Inclusive summation

```

# Answer
> 1 votes
# Haskell, ~~74~~ 70 bytes

```
f(h:t)|(b,e)<-read$'(':init t++")"=sum$[b..e]++[-b|h<'[']++[-e|')'<-t]

```

Try it online!

# Answer
> 1 votes
# Perl 5, 72 bytes

```
/(\()?(\d+),(\d+)(\))?/;$m=$3-!!$4;$n=$2+!!$1;$_=($m*($m+1)-$n*($n-1))/2

```

Try it online!

Another beautiful regular expression saves the day. This regex has four capture groups.

* `$1` is truthy iff we start with an open parenthesis
* `$2` is the lower bound
* `$3` is the upper bound
* `$4` is truthy iff we end with a close parenthesis

From there, we set up our lower and upper bounds, using the conditional parentheses to adjust so we always have an inclusive range, and then it's just a matter of arithmetic.

---
Tags: code-golf, arithmetic
---


title: Quote a rational number

text:
# Question
Title: Quote a rational number
Quote notation<sup>\[1\]</sup> is a way of expressing rational integers in a precise, finite manner, based on the concept of \\$p\\$-adic numbers. The notation is in the form of a string of digits (\\$0123456789\\$) containing exactly one "quote" (a \\$\newcommand{'}\[2\]{#1\text{'}#2} \text{'}\\:\\$) and one "radix point" (a \\$.\\:\\$). Like with standard decimal notation, if the radix point is at the right end of the string, it is omitted. Some examples of quote notation:

$$\begin{array} & \\' {123} {456} & \\' {123} {} & \\' {} {456} \\ \\' {12.3} {456} & \\' {12.3} {} & \\' {} {4.56} \\ \end{array}$$

**Interpreting quote notation**

The first thing to handle is the radix point. This point has the same function as regular decimal notation: it divides the integer form of the number by the base (\\$10\\$) equal to the number of places it is from the end. Therefore, we can rewrite our 3 examples with a radix point as

$$\begin{array} & \\' {123} {456} \div 10^4 & \\' {123} {} \div 10 & \\' {} {456} \div 10^2 & \end{array}$$

Now, we can interpret the quote. The quote indicates that the digits to its left should be repeated infinitely to the left, then have the digits to the right appended to the right end. If there are no digits to the left of the quote, a zero is taken instead:

$$ \\' {123} {456} = \dots 123123456 \\ \\' {123} {} = \dots 123123 \\ \\' {} {456} = \dots 000 456 $$

We then consider the following converging series:

$$\cdots + 10^{3k} + 10^{2k} + 10^{k} + 10^{0} = \frac 1 {1 - 10^k}$$

where \\$k\\$ is equal to the number of digits to the left of the quote (\\$k = 1\\$ from the implicit \\$0\\$ if there are no digits). We can then approach the infinite number in the following way:

$$\begin{align} \\' {123} {456} & = \dots 123123456 \\ & = 456 + \dots 123123000 \\ & = 456 + 1000 \times \dots 123123 \\ & = 456 + 1000 \times \dots \\' {123} {} \\ & = 456 + 1000 \times (\cdots 123 \times 10^9 + 123 \times 10^6 + 123 \times 10^3 + 123 \times 10^0) \\ & = 456 + 1000 \times 123 \times (\cdots + 10^9 + 10^6 + 10^3 + 10^0) \\ & = 456 + 123000 \times \left( \frac 1 {1 - 10^3} \right) \\ & = 456 - \frac {123000} {999} \\ & = \frac {110848} {333} \end{align}$$

If the original number had a radix point in (say, \\$\\' {12.3} {456}\\$), then we just "bring back" the division we performed earlier: \\$\\' {12.3} {456} = \\' {123} {456} \div 10^4 = \frac {110848} {333} \div 10^4 = \frac {6928} {208125}\\$

With this notation, we can express any rational number in a finite string of digits with a quote and potentially a radix point.

Additionally, the 4 basic operations - addition, subtraction, multiplication and division - are fully defined for quote notated values, and produce exact values with no roundoff errors.

**Rational numbers to quote notation**

Unfortunately, while there is a clearly defined algorithm for mapping a quote notated value to a rational number, doing the inverse can be far more taxing. The simplest method is to combine the fact that negation and division are clearly and fully defined for quote notated values, then using these to calculate the quote notation form of a rational number.

Natural numbers are easily expressed in quote notation, as are positive finite terminating decimals. \\$\\' {} z\\$ is the quote notation form of a natural number \\$z\\$, or a finite terminating decimal \\$z\\$. For example, \\$\\' {} 2 = 2\\$ and \\$\\' {} {3.2} = 3.2\\$. Negative integers and negative finite terminating decimals are also fairly trivial to derive, through negation of their positive equivalents. From these two points, we can then divide any two integers or finite terminating decimals to construct any arbitrary rational number, expressed in quote notation form.

**Negating quote notated values**

The easiest way to negate any quote notated value is to subtract it from \\$\\' 0 {}\\$. This is almost exactly like digit-wise subtraction for regular decimal numbers, but rather than "borrowing" a digit from the left if the minuend digit is less than the subtrahend, we "carry" a digit. For example, to negate \\$\\' {429} {}\\$:

$$\begin{array} \dots & 0 & 0 & 0 & 0 & 0 & 0 \\ \dots & 4\_1 & 2\_1 & 9\_1 & 4\_1 & 2\_1 & 9 \\ \hline \\ \dots & 5 & 7 & 0 & 5 & 7 & 1 & = \\' {057} 1 \end{array}$$

We start by subtracting the \\$9\\$ from \\$0\\$ on the right end. As \\$0 \< 9\\$, we carry a digit along (notated by \\$2\_1\\$ etc.) and subtract \\$9\\$ from \\$10\\$, yielding \\$1\\$. We then repeat this for each digit to the left, adding the carry to the subtrahend (\\$10 - (2 + 1) = 7\\$, carry a \\$1\\$ as \\$0\< (2+1)\\$, etc.). Eventually, we'll end up with a section repeating infinitely to the left, so we can put our quote in.

**Dividing quote notated values**

Division can be calculated through examining the last digit of both the divisor and the dividend, and is built up from the right end of the result. This is best demonstrated with an example, \\$\\' {} {143} \div \\' {} {333}\\$:

We examine the last digit to determine what we multiply the divisor by. We then subtract this multiple from the dividend until we reach a repeated difference. In the example below, the quotes have been fully expanded, and subtraction carries have been omitted:

$$\begin{array}{rrccccccccl} & \dots & 0 & 0 & 0 & 0 & 0 & 1 & 4 & 3 & = \\' {} {143} \\ \- & \dots & 0 & 0 & 0 & 0 & 0 & 3 & 3 & 3 & = \\' {} {333} \times 1 \\ \hline \\ & \dots & 9 & 9 & 9 & 9 & 9 & 8 & 1 & & \\' {} {} \\ \- & \dots & 0 & 0 & 0 & 2 & 3 & 3 & 1 & & = \\' {} {333} \times 7 \\ \hline \\ & \dots & 9 & 9 & 9 & 7 & 6 & 5 & & & \\ \- & \dots & 0 & 0 & 1 & 6 & 6 & 5 & & & = \\' {} {333} \times 5 \\ \hline \\ & \dots & 9 & 9 & 8 & 1 & 0 & & & & \\ \- & \dots & 0 & 0 & 0 & 0 & 0 & & & & = \\' {} {333} \times 0 \\ \hline \\ \- & \dots & 9 & 9 & 8 & 1 & & & & & \text{Repeated value} \\ \end{array}$$

Each step, we leave the last digit that was cancelled from the subtraction blank. Note that this is only the last digit, not all trailing zeros, as these can have an impact on the final result.

In this case, we have the digits of our division, we just need to know where to place the quote. We always place the quote immediately after the first occurrence of the repeated value (marked with a quote in the example above). For our example, \\$\\' {} {143} \div \\' {} {333} = \\' {057} {1}\\$

However, this only works in cases where the divisor (\\$\\' {} {333}\\$ in the example) is co-prime with \\$10\\$. If the denominator in the fraction \\$\frac a b\\$ is not co-prime with \\$10\\$, we need to manipulate the fraction to the form \\$\frac x {10\times y}\\$ where \\$y\\$ is co-prime to \\$10\\$, then extract the \\$\div 10\\$ to modify the position of the radix point in the result \\$x \div y\\$. For example, \\$8 \div 15\\$:

$$\begin{align} 8 \div 15 & = 16 \div 30 \\ & = 16 \div 3 \div 10 \\ 16 \div 3 & = \\' 6 {72} \\ \therefore 16 \div 3 \div 10 & = \\' 6 {72} \div 10 \\ & = \\' 6 {7.2} \\ \therefore 8 \div 15 & = \\' 6 {7.2} \end{align}$$

This way, we are fully able to divide any natural number by another, allowing us to express all positive rational numbers. Through negation, we can then express all rational numbers.

**Normalisation of quote notation**

As the left hand side of the quote is infinite, it is possible to "roll" it into the right hand side, to obtain an alternate form of the value. For example \\$\\' {057} 1 = \\' {705} {71}\\$ (try writing them both out if you can't see it). Therefore, it is usually possible to *normalise* a quote notated value by potentially rolling any leading digits from the right side of the quote into the left side.

The normalised form of quote notation is always the shortest possible representation of that number.

---

You are to take a rational number as input, and output the normalised quote notation form of this rational number.

You may choose to take input as either a fraction \\$\frac a b\\$, or as two integers \\$a, b\\$. If the input is negative and you take 2 integers as input, you may choose which integer has the negative sign, so long as it's consistent. In either case, the fraction will be fully simplified, and \\$b\\$ will never be equal to 0. If \\$b\\$ is equal to \\$1\\$, you may choose to omit it.

You may output the quote notated value in any reasonable manner. For example, outputting as a string with 2 distinct, non-digit characters representing the quote and radix point, or outputting 2 lists of digits and a power of 10 to represent the radix point.

Note that there may not be digits after the quote, and that leading zeros matter for both strings of digits, so the format you choose must be able to represent significant leading zeros, as well as distinguish between an empty output and a zero output.

This is so the shortest code in bytes wins.

## Test cases

```
2/1    = '2
-85/7  = 571428'45
58/3   = 6'86
-11/8  = 9'8.625
32/21  = 047619'2
-85/56 = 714285'5.625
677/86 = 162790697674418604651'9.5
-332/9 = 8'52
71/51  = 1960784313725490'21
1/17   = 2941176470588235'3
-1/900 = .11'
389/198 = 35'5.5
-876/83 = 38554216867469879518072289156626506024096'28
-38/2475 = 3.5'2
-1081/2475 = 67'.24

```

# Answer
> 5 votes
# Wolfram Language (Mathematica), ~~142~~ ~~128~~ 125 bytes

```
{Clear@r;_r:=e<(e=10#2~GCD~e);e=10;l=1//.o_?r:>10o,n=l#;{}//.g_/;!r@n:>(For[j=0;r@n=l--,!e∣n,n-=#2,j++];n/=10;j<>g),r@n-l}&

```

Try it online!

Input `[n, d]`. Implements the division algorithm. Returns `{r, QD, q} | r`, where `QD` is a `StringJoin` of digits and `r` is a power of ten, representing \\$\text{Q}\_1\cdots\text{Q}\_q\text{'D}\times\frac{1}{r}\\$.

---

For a nicer output format, **~~141~~ 138 bytes**:

```
{Clear@r;_r:=e<(e=10#2~GCD~e);e=10;l=1//.o_?r:>10o,n=l#;TakeDrop[{}//.{g___}/;!r@n:>{For[j=0;r@n=l--,!e∣n,n-=#2,j++];n/=10;j,g},r@n-l]}&

```

Try it online!

Input `[n, d]`. Returns `{r, {Q, D}}`, where `Q` and `D` are lists of digits and `r` is a power of ten, representing \\$\text{Q'D}\times\frac{1}{r}\\$.

---

Another approach, **~~154~~ ~~159~~ 153 bytes**

```
q±#|l@#-#2&@@r[FromDigits[a___~g~b_List:{9}:={q=If[#<0,b,9-b]~RotateRight~l@!a};g@@@r@#]10^l@q+#]&
{a_,b___}±{a_,c___}={b,a}±{c}
l=Length
r=RealDigits

```

Try it online!

Input `[n/d]`. Computes the quoted number from the input's (possibly repeating) decimal representation. Returns `Q ± D | r`, where `Q` and `D` are lists of digits and `r` is a nonnegative integer, representing \\$\text{Q'D}\times10^{-r}\\$. Normalization costs 39 bytes.

Uses \\$0=b\_1b\_2...b\_n\text'\overline{b\_1b\_2...b\_n}\\$, i.e. any infinitely repeating sequence (in both directions).

# Answer
> 1 votes
# Charcoal, 202 bytes

```
ＮθＮη≔⁰ζＦ⟦χ⁵¦²⟧Ｗ¬﹪ηι«≦⊕ζ≧÷ιη≧×÷χιθ»¿⊖η«≔χεＷ﹪⊖εη≧×χε≧×÷⊖εηθ≔θδ≔¹ηＷ÷⁻×⊖ε﹪θηδ×εη«≧×χη≔×±δ↨Ｅ↨⊖ηε¹εθ»≔ΦＩ⁺ε÷⁻×⊖ε﹪θηδηκδ»«≔¹ηＷ÷⁺θη⊗η≧×χη≔…9‹θ⁰δ»≔ΦＩ⁺η﹪θηκη≦⁻Ｌ⁺δηζＷ⮌…∨⮌δ0±ζ«≔⁺ιηη≔…⁺ιδＬδδ≔⁰ζ»⭆δ⁺….⁼κζι'⭆η⁺….⁼⁺Ｌδκζι

```

Try it online! Link is to verbose version of code. Takes numerator and denominator on separate lines. Explanation:

```
ＮθＮη

```

Input the numerator and denominator.

```
≔⁰ζＦ⟦χ⁵¦²⟧Ｗ¬﹪ηι«≦⊕ζ≧÷ιη≧×÷χιθ»

```

Calculate the position of the decimal point, and adjust the fraction by the appropriate power of 10, so the denominator's GCD with 10 is now 1.

```
¿⊖η«

```

If the denominator is still greater than 1, then:

```
≔χεＷ﹪⊖εη≧×χε

```

Calculate the smallest string of `9`s that is divisible by the denominator.

```
≧×÷⊖εηθ≔θδ

```

Calculate the numerator for that string of `9`s as a denominator.

```
≔¹ηＷ÷⁻×⊖ε﹪θηδ×εη

```

See whether we can create quote notation for that fraction.

```
«≧×χη≔×±δ↨Ｅ↨⊖ηε¹εθ»

```

If not, add another digit after the quote and try again. Note that this involves calculating the multiplicative inverse of the denominator modulo the power of 10 given by the number of digits after the quote.

```
≔ΦＩ⁺ε÷⁻×⊖ε﹪θηδηκδ

```

Calculate the digits before the quote.

```
»«

```

If the denominator was 1, meaning that we had a terminating decimal, then:

```
≔¹ηＷ÷⁺θη⊗η≧×χη

```

Calculate the number of digits after the quote. This is particularly significant for negative numbers, but it also means that I can share the code that generates digits after the quote.

```
≔…9‹θ⁰δ»

```

Place a 9 before the quote if the value is negative.

```
≔ΦＩ⁺η﹪θηκη

```

Calculate the digits after the quote.

```
≦⁻Ｌ⁺δηζＷ⮌…∨⮌δ0±ζ

```

If there are not enough digits for the decimal point, then...

```
«≔⁺ιηη≔…⁺ιδＬδδ≔⁰ζ»

```

... add digits after the quote as necessary, using digits from before the quote or `0`s if there are none, rotating the digits before the quote.

```
⭆δ⁺….⁼κζι'⭆η⁺….⁼⁺Ｌδκζι

```

Output the digits before and after the quote, inserting the decimal point appropriately (unless it goes at the end, in which case it isn't output).

---
Tags: code-golf, math, rational-numbers
---