|
|
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
|
|
|
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[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)
(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)]
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|