Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #36 Mar 15 2020 09:42:57
%S 1,0,0,1,1,-1,1,1,1,-1,0,0,0,-1,0,1,1,-1,1,1,0,1,-1,1,1,1,1,1,1,0,0,
%T -1,0,0,0,0,-1,1,-1,-1,-1,-1,1,-1,0,-1,0,-1,0,-1,-1,0,1,-1,-1,1,1,0,0,
%U 1,0,0,1,1,-1,0,0,-1,1,0,0,0,-1,-1,1,-1,-1,1,-1
%N Expansion of Pi in balanced ternary.
%C The correspondence to A004602 (see Formula section) can be seen by comparing the leading terms of each sequence from right to left and adding a carry when A004602 is 2:
%C A004602: 1, 0, 0, 1, 0, 2, 1, 1, 0, 1, 2, 2, 2, 2, 0, 1, 0, 2, 1, 1, 0, 0, 2, 1
%C a(n) : 1, 0, 0, 1, 1,-1, 1, 1, 1,-1, 0, 0, 0,-1, 0, 1, 1,-1, 1, 1, 0, 1,-1, 1
%H Iain Fox, <a href="/A331313/b331313.txt">Table of n, a(n) for n = 2..20000</a>
%H Thomas König, <a href="/A331313/a331313.c.txt">Program to calculate the sequence with C and the GNU mpfr library</a>
%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Balanced_ternary">Balanced ternary</a>
%F Calculation can be done from A004602:
%F Choose n so that A004602(n) does not equal 2
%F Initialize {f(n)} from A004602 up to index n
%F Let i loop from n down to 2
%F while f(i) is larger than 1
%F set f(i) to f(i) - 3
%F set f(i - 1) to f(i - 1) + 1
%F Set {a(n)} to {f(n)}
%e 10.011T111T000T011T1101T11111100T0000T...
%o (C) See link by Thomas König
%o (PARI) \\ (adjust realprecision as needed)
%o first(n) = {default(realprecision, 10000); for(x=-1, +oo, v=digits(floor(Pi*3^(n+x)), 3); if(v[#v]!=1, break())); while(vecmax(v)==2, for(x=1, #v, if(v[x]==2, v[x]=-1; v[x-1]++))); vecextract(v,2^n-1)} \\ _Iain Fox_, Feb 03 2020
%Y Pi in base b: A004601 (b=2), A004602 (b=3), A004603 (b=4), A004604 (b=5), A004605 (b=6), A004606 (b=7), A006941 (b=8), A004608 (b=9), A000796 (b=10), A068436 (b=11), A068437 (b=12), A068438 (b=13), A068439 (b=14), A068440 (b=15), A062964 (b=16), A060707 (b=60).
%Y Expansion of e in balanced ternary: A331990.
%K sign,base,easy
%O 2
%A _Thomas König_, Jan 13 2020