# Tag Info

1 vote

Raku (Perl 6) (rakudo) (exact), 113 bytes {$/=(0,2);(grep {$1**$_>(my$d=min map {1/$_ max$_},((2 X**^$_)X*(⅔.FatRat**$_)))**$0&&($/=($_,$d))},1..*)[^$_]} ... • 3,258 2 votes ### Factoriadic Fraction Addition Setanta, 175 153 150 146 bytes ... • 3,258 1 vote ### Factoriadic Fraction Addition Wolfram Language (Mathematica), 305 bytes A port of @Dominic van Essen' R code in Mathematica. 305 bytes, it can be golfed more. Golfed version. Try it online! ... • 6,101 2 votes ### Rabinowitz-Wagon $\pi$ formula Wolfram Language (Mathematica), 63 45 bytes Saved 18 bytes thanks to @att Golfed version. Try it online! {2,1}Dot@@Array[{{#,a=2#+1},{0,a}}&,#].{0,1}& ... • 6,101 2 votes ### Rabinowitz-Wagon $\pi$ formula R, 84 bytes \(n,m=0:n*2+1)cbind(Reduce(\(a,b)a*b+2*prod(1:((b-1)/2)),c(2,m),,,T)[-1],cumprod(m)) Attempt This Online! An anonymous function that takes an integer $... 1 vote ### Rabinowitz-Wagon$\pi$formula Kap: 21 characters (1+)⍛×/⌽2,÷∘(1+2×)1+⍳ This function takes n, and returns a rational number. This takes advantage of the ... 1 vote ### Rabinowitz-Wagon$\pi$formula ## APL, 36 bytes This is a function that takes n as input and outputs a pair of integers representing the numerator and denominator of the answer: ... 3 votes ### Rabinowitz-Wagon$\pi$formula PARI/GP, 28 bytes n->(z=2)+sum(i=1,n,z/=2+1/i) Attempt This Online! A port of @G B's Ruby answer.$0$-indexed. Returns a rational number. PARI/GP, 43 bytes <... • 49.1k 1 vote ### Counterexample to Shapiro inequality My first codegolf on this form-- n=gets.to_i;s=[1]*n;loop{s[0]+=1;y=0;n.times{|i|y+=s[i].to_f/(s[(i+1)%n]+s[(i+2)%n])};break if y*2>=n};p s Total 107 bytes, not ... 3 votes ### Rabinowitz-Wagon$\pi$formula M, 11 bytes RḤ‘İ×R×\S‘Ḥ Try it online! Interestingly enough, the Jelly equivalent (which doesn't have rational number support) is only 1 byte longer. The TIO link ... • 50.1k 4 votes ### Rabinowitz-Wagon$\pi$formula Ruby, 38 35 bytes ->n{(z=2)+(1..n).sum{|x|z/=2+1r/x}} Try it online! • 22.3k 3 votes ### Rabinowitz-Wagon$\pi$formula Charcoal, 27 bytes ＮθＩＥ²ΣＥ∨ι⊕θΠ⊕⊞ＯＥθ⎇‹νλν⊗⊕ν¬ι Try it online! Link is to verbose version of code. Explanation: Directly computes the numerator and denominator, ... • 174k 2 votes ### Rabinowitz-Wagon$\pi$formula APL(Dyalog Unicode), 31 2724 21 bytes SBCS It outputs the$n$th term with the denominator comes before the numerator. Assumes ⎕io←0. 24 -> 21 bytes thanks to @... • 845 3 votes ### Rabinowitz-Wagon$\pi$formula JavaScript (Node.js), 43 bytes f=(n,p=q=1)=>n?f(n-1,p*n+(q*=n-~n)):[p*2,q] Attempt This Online! Port of shape warrior t's answer • 25.6k 9 votes ### Rabinowitz-Wagon$\pi$formula J, 14 bytes 2#.~1%2+1%]-i. Attempt This Online! If we expand the formula entirely, we get ... • 78.1k 6 votes ### Rabinowitz-Wagon$\pi$formula K (ngn/k), 24 bytes 2 1*1(|+\|*)/+-\(1-)\!-: Try it online! Input n. Return the$n$th term as an integer pair. • 21k 12 votes ### Rabinowitz-Wagon$\pi$formula Python, 71 70 60 57 bytes f=lambda n,q=1,p=1:n and f(n-1,q:=q*2*n+q,p*n+q)or(2*p,q) Attempt This Online! Outputs the (0-indexed) nth term of the sequence as a (... 4 votes ### Rabinowitz-Wagon$\pi$formula Vyxal s, 51 bitsv2, 6.375 bytes ƛƛd›/;Πd Try it Online! Bitstring: ... • 33.9k 3 votes ### Rabinowitz-Wagon$\pi\$ formula

Raku (Perl 6) (rakudo), 49 43 bytes {2+2*[+] [\*] map {.FatRat/(2*$_+1)},1..$_} Attempt This Online!
• 3,258

R, 125 bytes \(v,w,^=c,y=w^0,s=seq){a=(!s(x<-v^0)-(e=s(x+y)))*x+y*!s(y)-e while(any(a-(a=a-(b=(a>e))*e-b+b[-1]^0)))1 a[s(l=max(e*!!a))]} Attempt This ...
• 35.8k

JavaScript (Node.js), 166 bytes ...
• 509
Accepted

Jelly, 17 bytes +dṛ¦J‘$F+2/ƲÐLœr0 A dyadic Link that accepts factoriadic fractions as lists of integers on each side and yields their sum. Try it online! Or see ... • 108k 4 votes ### Factoriadic Fraction Addition Nekomata + -1, 18 bytes +:#ᵑ{CU$x3+þç++;ž¿ Attempt This Online! ...
• 49.1k

Charcoal, 57 bytes Ｆ⁻ＬηＬθ⊞θ⁰≔⁰ζＦ⮌Ｅηκ«≧⁺⁺§θι⊟ηζ§≔θι⎇ι﹪ζ⁺²ιζ≧÷⁺²ιζ»Ｗ∧θ¬↨θ⁰⊟θＩθ Try it online! Link is to verbose version of code. Explanation: ...
• 174k

APL(Dyalog Unicode), 35 bytes SBCS Assumes index origin 0. {x↓⍨-⊥⍨0=x←(⊢⊤⊥∘m)(⊢+2××)⍳≢m←+⌿↑⍺⍵} Try it on APLgolf! Add the inputs element-wise, convert back and ...
• 59.9k

JavaScript (Node.js), 93 bytes f=([a=0,...A],[b=c=0,...B],i)=>k=A+B||a|b?f(A,B,i+1||2)!=-(b+=c+a,c=b>i,b+=c*~i)?[b,...k]:k:A Try it online! ...
• 25.6k
Raku (Perl 6) (rakudo), 50 34 bytes Takes a list of Rational numbers. {(@$_ X==@$_).rotor(\$_)>>.sum.max} Attempt This ...