OFFSET
1,2
COMMENTS
LINKS
FORMULA
EXAMPLE
A360505(4) = 111021 and 111021_3 = 358_10 = a(4).
PROG
(PARI) a(n) = fromdigits(concat([digits(k, 3) | k <- Vecrev([1..n])]), 3) \\ Rémy Sigrist, Feb 18 2023
(Python)
from sympy.ntheory import digits
def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in range(n, 0, -1)), 3)
print([a(n) for n in range(1, 21)]) # Michael S. Branicky, Feb 19 2023
(Python) # faster version for initial segment of sequence
from sympy.ntheory import digits
from itertools import count, islice
def agen(s=""): yield from (int(s:="".join(map(str, digits(n, 3)[1:]))+s, 3) for n in count(1))
print(list(islice(agen(), 20))) # Michael S. Branicky, Feb 19 2023
(Python)
from itertools import count, islice
def A360506_gen(): # generator of terms
a, b, c = 3, 1, 0
for i in count(1):
if i >= a:
a *= 3
c += i*b
yield c
b *= a
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Feb 17 2023
EXTENSIONS
More terms from Rémy Sigrist, Feb 18 2023
STATUS
approved