OFFSET
1,2
COMMENTS
Terms in the trajectories for the Collatz (3x+1) problem can be used to approximate the value of Pi. This method was found by Roland Yéléhada (see the links below).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
Manon Bischoff, Pi is everywhere, even in the Collatz problem (in German), Spektrum der Wissenschaft, 2022
Jean-Paul Delahaye, The number Pi is everywhere (in French), interstices, 2017
Alois P. Heinz, Plot of sqrt(6*n/a(n)) - Pi for n = 1..1000000
Wikipedia, Basel Problem
Wikipedia, Collatz Conjecture
Wikipedia, Iverson bracket
FORMULA
EXAMPLE
a(5) = 4 = 1 + 1 + 1 + 1 + 0, because gcd(1,1) = gcd(2,3) = gcd(8,49) = gcd(3,7) = 1 and gcd(6,36) > 1.
a(1000) = 606 -> sqrt(6*1000/a(1000)) = 3.14658387763... .
MAPLE
b:= proc(n) option remember; [n, 1]+
`if`(n=1, 0, b(`if`(n::even, n/2, 3*n+1)))
end:
a:= proc(n) option remember; `if`(n<1, 0,
a(n-1)+1-signum(igcd(b(n)[])-1))
end:
seq(a(n), n=1..68);
MATHEMATICA
b[n_] := b[n] = {n, 1} + If[n == 1, {0, 0}, b[If[EvenQ[n], n/2, 3*n + 1]]];
a[n_] := a[n] = If[n < 1, 0, a[n - 1] + 1 - Sign[GCD @@ b[n] - 1]];
Table[a[n], {n, 1, 68}] (* Jean-François Alcover, Sep 04 2024, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 22 2024
STATUS
approved