login

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”).

A331313
Expansion of Pi in balanced ternary.
4
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, -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, 1, 0, 0, 1, 1, -1, 0, 0, -1, 1, 0, 0, 0, -1, -1, 1, -1, -1, 1, -1
OFFSET
2
COMMENTS
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:
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
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
FORMULA
Calculation can be done from A004602:
Choose n so that A004602(n) does not equal 2
Initialize {f(n)} from A004602 up to index n
Let i loop from n down to 2
while f(i) is larger than 1
set f(i) to f(i) - 3
set f(i - 1) to f(i - 1) + 1
Set {a(n)} to {f(n)}
EXAMPLE
10.011T111T000T011T1101T11111100T0000T...
PROG
(C) See link by Thomas König
(PARI) \\ (adjust realprecision as needed)
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
CROSSREFS
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).
Expansion of e in balanced ternary: A331990.
Sequence in context: A285427 A285621 A204435 * A267155 A204445 A179184
KEYWORD
sign,base,easy
AUTHOR
Thomas König, Jan 13 2020
STATUS
approved