OFFSET
1,1
COMMENTS
Composing the map A138750 with A007918 to the left and restricting it to the primes makes it a mapping from primes into primes which is a natural generalization of the Collatz problem to primes. (Looking at parity would not be interesting for primes, so using "mod 3" is the simplest nontrivial generalization.)
The only even prime p=2 is the only fixed point of this map and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in A138752.
The sequence A124123 lists the primes which do not occur in the present sequence.
See A138750 for further information.
LINKS
Paolo Xausa, Table of n, a(n) for n = 1..10000
Georges Brougnard, Definition of GB-sequences.
EXAMPLE
a(1) = nextprime(2/2) = 2, a(2) = nextprime(2*3) = 7, a(3) = nextprime(5/2) = 7.
MATHEMATICA
A138751[n_]:=With[{p=Prime[n]}, NextPrime[If[Mod[p, 3]==2, p/2, 2p]]]; Array[A138751, 100] (* Paolo Xausa, Jul 28 2023 *)
PROG
(PARI) A138751(n) = { n=prime(n); nextprime( if( n%3==2, ceil(n/2), 2*n ))}
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Mar 28 2008
STATUS
approved