login
A007942
Decimal concatenation of sequence (n, n-1, ..., 2, 1, 2, ..., n-1, n).
9
1, 212, 32123, 4321234, 543212345, 65432123456, 7654321234567, 876543212345678, 98765432123456789, 109876543212345678910, 1110987654321234567891011, 12111098765432123456789101112, 131211109876543212345678910111213, 1413121110987654321234567891011121314
OFFSET
1,2
COMMENTS
For n <= 1530, only a(13) = 131211109876543212345678910111213 is prime. - XU Pingya, May 21 2017
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..202
MAPLE
a:= n-> parse(cat(n-i$i=0..n-1, $2..n)):
seq(a(n), n=1..23); # Alois P. Heinz, Dec 19 2021
MATHEMATICA
Table[d = Flatten[IntegerDigits /@ Range@ n]; FromDigits@ Flatten[{Reverse@ d, Rest@ d}, 1], {n, 11}] (* Michael De Vlieger, Aug 20 2015 *)
PROG
(PARI) a(n) = s = ""; forstep (k=n, 1, -1, s = concat(s, k)); for (k=2, n, s = concat(s, k)); eval(s); \\ Michel Marcus, Aug 20 2015
(Python)
from itertools import count, islice
def agen(): # generator of terms
s = "1"
for n in count(2):
yield int(s)
s = str(n) + s + str(n)
print(list(islice(agen(), 14))) # Michael S. Branicky, Dec 09 2022
(Python)
def A007942(n): return int(''.join(map(str, range(n, 1, -1)))+''.join(map(str, range(1, n+1)))) # Chai Wah Wu, Mar 21 2023
CROSSREFS
Sequence in context: A204299 A332121 A083962 * A210257 A239045 A262657
KEYWORD
nonn,base,easy
AUTHOR
R. Muller
STATUS
approved