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!)
A320028 a(n) is the first prime encountered when running the Collatz algorithm (halving and tripling steps) on the number n. 1
2, 3, 2, 5, 3, 7, 2, 7, 5, 11, 3, 13, 7, 23, 2, 17, 7, 19, 5, 2, 11, 23, 3, 19, 13, 41, 7, 29, 23, 31, 2, 19, 17, 53, 7, 37, 19, 59, 5, 41, 2, 43, 11, 17, 23, 47, 3, 37, 19, 29, 13, 53, 41, 83, 7, 43, 29, 59, 23, 61, 31, 137, 2, 37, 19, 67, 17, 13, 53, 71, 7, 73, 37, 113, 19, 29, 59, 79, 5, 61, 41, 83, 2, 2, 43, 131 (list; graph; refs; listen; history; text; internal format)
OFFSET
2,1
COMMENTS
A modified version of the halving and tripling Collatz algorithm, which stops as soon as the starting number becomes a prime (instead of stopping when the starting number reaches 1).
The plot of this sequence "completes" or "fills" the lower (empty) part of plot of A270570 and evolves in a similar fashion.
LINKS
Alessandro Polcini, Table of n, a(n) for n = 2..10000 (a(2024) corrected by Michel Marcus, Jun 14 2022)
FORMULA
a(n) <= A087272(n). - Rémy Sigrist, Oct 08 2018
EXAMPLE
a(4) is 2 because 4/2 = 2 and 2 is prime.
a(6) is 3 because 6/2 = 3 and 3 is prime.
a(15) is 23 because 15*3 + 1 = 46; 46/2 = 23 and 23 is prime.
a(18) is 7 because 18/2 = 9; 9*3 + 1 = 28; 28/2 = 14; 14/2 = 7 and 7 is prime.
MATHEMATICA
Array[NestWhile[If[EvenQ@ #, #/2, 3 # + 1] &, #, ! PrimeQ@ # &] &, 86, 2] (* Michael De Vlieger, Nov 07 2018 *)
PROG
(Java) int collatzPrime(int i) {
while(!BigInteger.valueOf(i).isProbablePrime(10) && i > 1) {
if(i % 2 == 0)
i /= 2;
else
i = 3 * i + 1;
}
return i;
}
(PARI) a(n) = {while (!isprime(n), if (n % 2, n = 3*n+1, n = n/2); ); n; } \\ Michel Marcus, Oct 28 2018
CROSSREFS
Sequence in context: A347619 A164858 A192330 * A327076 A215041 A347241
KEYWORD
nonn
AUTHOR
Alessandro Polcini, Oct 03 2018
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 May 20 05:07 EDT 2024. Contains 372703 sequences. (Running on oeis4.)