cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A007942 Decimal concatenation of sequence (n, n-1, ..., 2, 1, 2, ..., n-1, n).

Original entry on oeis.org

1, 212, 32123, 4321234, 543212345, 65432123456, 7654321234567, 876543212345678, 98765432123456789, 109876543212345678910, 1110987654321234567891011, 12111098765432123456789101112, 131211109876543212345678910111213, 1413121110987654321234567891011121314
Offset: 1

Views

Author

R. Muller

Keywords

Comments

For n <= 1530, only a(13) = 131211109876543212345678910111213 is prime. - XU Pingya, May 21 2017

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