A360506 Read A360505(n) as if it were a base-3 string and write it in base 10.
1, 7, 34, 358, 4003, 43369, 456712, 4708240, 47754961, 1339156591, 39693785002, 1169411930926, 34213667699203, 995038950807565, 28790341783585180, 829295063367580492, 23793774263808446005, 680307709052882601259, 19390954850541496025998
Offset: 1
Examples
A360505(4) = 111021 and 111021_3 = 358_10 = a(4).
Links
Programs
-
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 A360506_list = list(islice(A360506_gen(),30)) # Chai Wah Wu, Nov 08 2023
Formula
Extensions
More terms from Rémy Sigrist, Feb 18 2023
Comments