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

A374363
a(n) is the greatest term t <= n of A005836 such that n - t also belongs to A005836.
3
0, 1, 1, 3, 4, 4, 3, 4, 4, 9, 10, 10, 12, 13, 13, 12, 13, 13, 9, 10, 10, 12, 13, 13, 12, 13, 13, 27, 28, 28, 30, 31, 31, 30, 31, 31, 36, 37, 37, 39, 40, 40, 39, 40, 40, 36, 37, 37, 39, 40, 40, 39, 40, 40, 27, 28, 28, 30, 31, 31, 30, 31, 31, 36, 37, 37, 39, 40
OFFSET
0,4
COMMENTS
To compute a(n): in the ternary expansion of n, 2's by 1's.
LINKS
FORMULA
a(n) = T(n, A120880(k)-1).
a(n) = n - A374362(n).
a(n) <= n with equality iff n belongs to A005836.
a(n) = A005836(1+A289831(n)).
EXAMPLE
The first terms, in decimal and in ternary, are:
n a(n) ter(n) ter(a(n))
-- ---- ------ ---------
0 0 0 0
1 1 1 1
2 1 2 1
3 3 10 10
4 4 11 11
5 4 12 11
6 3 20 10
7 4 21 11
8 4 22 11
9 9 100 100
10 10 101 101
11 10 102 101
12 12 110 110
13 13 111 111
14 13 112 111
15 12 120 110
PROG
(PARI) a(n) = fromdigits(apply(d -> [0, 1, 1][1+d], digits(n, 3)), 3)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Rémy Sigrist, Jul 06 2024
STATUS
approved