OFFSET
1,2
COMMENTS
If the terms are read as ternary strings and converted to base 10, we get A048435. For example, a(2) = 12_3 = 5_10, which is A048435(2). This is a prime, and gives the first term of A360503.
If the terms are read as decimal numbers, which of them are primes? 12101112202122100101102110111, for example, is not a prime, since it is 37*327057086543840543273030003.
When read as decimal numbers, the first prime is a(7315), with 56003 digits. - Michael S. Branicky, Apr 18 2023
LINKS
EXAMPLE
a(4): concatenate 1, 2, 10, 11, getting 121011.
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, (l-> parse(cat(
a(n-1), seq(l[-i], i=1..nops(l)))))(convert(n, base, 3)))
end:
seq(a(n), n=1..15); # Alois P. Heinz, Feb 17 2023
MATHEMATICA
nn = 15; s = IntegerDigits[Range[nn], 3]; Array[FromDigits[Join @@ s[[1 ;; #]]] &, nn] (* Michael De Vlieger, Apr 19 2023 *)
PROG
(Python)
from sympy.ntheory import digits
def a(n): return int("".join("".join(map(str, digits(k, 3)[1:])) for k in range(1, n+1)))
print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Feb 18 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:=s+"".join(map(str, digits(n, 3)[1:]))) for n in count(1))
print(list(islice(agen(), 15))) # Michael S. Branicky, Feb 18 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
N. J. A. Sloane, Feb 16 2023
STATUS
approved