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.

User: Samuel Vilz

Samuel Vilz's wiki page.

Samuel Vilz has authored 1 sequences.

A346180 a(n) = prime(n) + n if n is prime, a(n) = prime(n) otherwise.

Original entry on oeis.org

2, 5, 8, 7, 16, 13, 24, 19, 23, 29, 42, 37, 54, 43, 47, 53, 76, 61, 86, 71, 73, 79, 106, 89, 97, 101, 103, 107, 138, 113, 158, 131, 137, 139, 149, 151, 194, 163, 167, 173, 220, 181, 234, 193, 197, 199, 258, 223, 227, 229, 233, 239, 294, 251, 257, 263, 269, 271
Offset: 1

Author

Samuel Vilz, Jul 09 2021

Keywords

Comments

For n > 0, take the n-th prime and only add n to it if n is prime itself.

Examples

			a(1) = 2 = 2+0; 2 is the first prime. 1 is not prime and thus is not added.
a(2) = 5 = 3+2; 3 is the second prime, and since 2 is also prime, add 2.
a(3) = 8 = 5+3; 5 is the third prime, and since 3 is also prime, add 3.
		

Crossrefs

Programs

  • Mathematica
    Table[Prime@n+Boole@PrimeQ[n]n,{n,60}] (* Giorgos Kalogeropoulos, Jul 29 2021 *)
    Table[If[PrimeQ[n],Prime[n]+n,Prime[n]],{n,60}] (* Harvey P. Dale, Nov 20 2022 *)
  • PARI
    a(n) = prime(n) + isprime(n)*n; \\ Michel Marcus, Jul 12 2021
    
  • Python
    from sympy import isprime, prime
    def a(n): return prime(n) + n*isprime(n)
    print([a(n) for n in range(1, 59)]) # Michael S. Branicky, Jul 29 2021
    
  • Python
    # faster version for initial segment of sequence
    from sympy import isprime, prime, primerange
    def aupton(nn): return [p + n*isprime(n) for n, p in enumerate(primerange(1, prime(nn)+1), start=1)]
    print(aupton(10000)) # Michael S. Branicky, Jul 29 2021

Formula

a(n) = A000040(n) + A061397(n).