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

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