The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A346180 a(n) = prime(n) + n if n is prime, a(n) = prime(n) otherwise. 0
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
For n > 0, take the n-th prime and only add n to it if n is prime itself.
LINKS
FORMULA
a(n) = A000040(n) + A061397(n).
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A250206 A138371 A140053 * A103311 A019824 A284868
KEYWORD
nonn
AUTHOR
Samuel Vilz, Jul 09 2021
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 6 06:26 EDT 2024. Contains 373115 sequences. (Running on oeis4.)