|
|
A347859
|
|
a(n) = n/2 if n/2 is a prime, else 3(n-1)/2 if (n-1)/2 is prime, else n.
|
|
0
|
|
|
0, 1, 2, 3, 2, 6, 3, 9, 8, 9, 5, 15, 12, 13, 7, 21, 16, 17, 18, 19, 20, 21, 11, 33, 24, 25, 13, 39, 28, 29, 30, 31, 32, 33, 17, 51, 36, 37, 19, 57, 40, 41, 42, 43, 44, 45, 23, 69, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 29, 87, 60, 61, 31, 93, 64, 65, 66, 67, 68, 69, 70
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,3
|
|
COMMENTS
|
Inspired by the "EKG permutation" A064413 which has a quite similar graph (a main ray with slope 1 and two secondary rays with slope 1/2 and 3/2) but probably not many other common properties.
|
|
LINKS
|
|
|
PROG
|
(PARI) apply( {a(n)=if(!isprime(n\2), n, n%2, n\2*3, n\2)}, [0..88])
(Python)
from sympy import isprime
def a(n):
if n%2 == 0 and isprime(n//2): return n//2
if (n-1)%2 == 0 and isprime((n-1)//2): return 3*(n-1)//2
return n
|
|
CROSSREFS
|
Cf. A064413 (EKG permutation), A100484 (twice the primes = even semiprimes).
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|