A007942 Decimal concatenation of sequence (n, n-1, ..., 2, 1, 2, ..., n-1, n).
1, 212, 32123, 4321234, 543212345, 65432123456, 7654321234567, 876543212345678, 98765432123456789, 109876543212345678910, 1110987654321234567891011, 12111098765432123456789101112, 131211109876543212345678910111213, 1413121110987654321234567891011121314
Offset: 1
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..202
- F. Smarandache, Only Problems, Not Solutions!
Programs
-
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 *)
-
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
Comments