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

A331990
Balanced ternary expansion of e.
2
1, 0, -1, 0, 1, 1, 1, -1, -1, 0, -1, 0, -1, 1, 1, 1, -1, 0, 1, 1, 1, -1, 0, 0, 0, -1, 1, 1, -1, 0, 1, 1, 1, 0, -1, 0, 0, 0, -1, 1, -1, -1, 1, 0, 0, 0, 0, -1, 1, 1, 0, -1, 0, 0, -1, -1, 1, -1, 1, -1, -1, 0, -1, -1, 0, 0, -1, 1, 1, 1, 0, 0, 1, -1, -1, 1, 0, 0, 0
OFFSET
2
COMMENTS
For the first n digits of the sequence, take the smallest substring with n or more digits of the standard ternary expansion of e (A004594) such that it does not end with 1 and prepend a 0. For n = 15, this would be:
0, 2, 2, 0, 1, 1, 0, 1, 1, 2, 1, 2, 2, 1, 1, 0.
Wherever there is a 2, change it to -1 and add 1 to the previous term:
1, 0, -1, 0, 1, 1, 0, 1, 2, -1, 2, 0, -1, 1, 1, 0.
Repeat until no 2's remain:
1, 0, -1, 0, 1, 1, 0, 2, -1, 0, -1, 0, -1, 1, 1, 0.
1, 0, -1, 0, 1, 1, 1, -1, -1, 0, -1, 0, -1, 1, 1, 0.
Remove all but the first n digits:
1, 0, -1, 0, 1, 1, 1, -1, -1, 0, -1, 0, -1, 1, 1.
EXAMPLE
e = 2.7182818284... = 1 * 3^1 + 0 * 3^0 - 1 * 3^(-1) + 0 * 3^(-2) + 1 * 3^(-3) + ... = 10.T0111TT0T0..._bal3
PROG
(PARI) first(n) = {default(realprecision, 10000); for(x=-1, +oo, v=concat([0], digits(floor(exp(1)*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)} \\ (adjust realprecision as needed)
CROSSREFS
Pi in balanced ternary: A331313.
Expansion of e in base b: A004593 (b = 2), A004594 (b = 3), A004595 (b = 4), A004596 (b = 5), A004597 (b = 6), A004598 (b = 7), A004599 (b = 8), A004600 (b = 9), A001113 (b = 10), A170873 (b = 16).
Sequence in context: A244527 A243566 A266112 * A301849 A074332 A152065
KEYWORD
base,easy,sign
AUTHOR
Iain Fox, Feb 03 2020
STATUS
approved