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.

A340008 a(n) is the image of n under the map: n -> n/2 if n is even, n-> n^2 - 1 if n is an odd prime, otherwise n -> n - 1.

Original entry on oeis.org

0, 1, 8, 2, 24, 3, 48, 4, 8, 5, 120, 6, 168, 7, 14, 8, 288, 9, 360, 10, 20, 11, 528, 12, 24, 13, 26, 14, 840, 15, 960, 16, 32, 17, 34, 18, 1368, 19, 38, 20, 1680, 21, 1848, 22, 44, 23, 2208, 24, 48, 25, 50, 26, 2808, 27, 54, 28, 56, 29, 3480, 30, 3720, 31, 62, 32
Offset: 1

Views

Author

Ya-Ping Lu, Dec 26 2020

Keywords

Comments

This map is used in A339991.

Crossrefs

Cf. A339991.

Programs

  • Mathematica
    Array[Which[EvenQ@ #, #/2, PrimeQ@ #, #^2 - 1, True, # - 1] &, 64] (* Michael De Vlieger, Dec 28 2020 *)
  • PARI
    a(n) = if (n%2, if (isprime(n), n^2-1, n-1), n/2); \\ Michel Marcus, Dec 26 2020
  • Python
    from sympy import isprime
    for n in range(1, 1001):
        if n%2 == 0: a = n/2
        elif isprime(n) == 1: a = n*n - 1
        else: a = n - 1
        print(a)