cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A354747 Start with 2*n-1; repeatedly triple and add 2 until reaching a prime. a(n) = number of steps until reaching a prime > 2*n-1, or 0 if no prime is ever reached.

This page as a plain text file.
%I A354747 #19 Jul 01 2022 22:16:08
%S A354747 1,1,1,1,1,2,1,1,1,1,2,1,2,1,1,3,1,1,1,2,10,1,1,2,1,2,4,1,1,1,2,1,1,4,
%T A354747 3,2,3,1,1,1,3,1,1,1,1,2,1,2,1,3,3,1,1,2,3,3,5,1,1,1,2,3,9,1,1,2,1,2,
%U A354747 4,1,2,1,6,1,1,2,1,1,5,1,3,1,2,1,1,3,1
%N A354747 Start with 2*n-1; repeatedly triple and add 2 until reaching a prime. a(n) = number of steps until reaching a prime > 2*n-1, or 0 if no prime is ever reached.
%C A354747 a(n) is the smallest m >= 1 such that 2*n*3^m - 1 is prime.
%C A354747 The smallest unknown case is n = 100943. Is a(100943) = 0?
%C A354747 If it exists, a(100943) > 30000. - _Michael S. Branicky_ and _Jon E. Schoenfield_, Jun 07 2022
%e A354747 For n = 21: Successively applying the map x -> 3*x+2 to 2*21-1 = 41 yields the sequence 41, 125, 377, 1133, 3401, 10205, 30617, 91853, 275561, 826685, 2480057, reaching the prime 2480057 after 10 steps, so a(21) = 10.
%o A354747 (PARI) a(n) = my(x=2*n-1, i=0); while(1, x=3*x+2; i++; if(ispseudoprime(x), return(i)))
%o A354747 (Python)
%o A354747 from sympy import isprime
%o A354747 def f(x): return 3*x + 2
%o A354747 def a(n):
%o A354747     fn, c = f(2*n-1), 1
%o A354747     while not isprime(fn): fn, c = f(fn), c+1
%o A354747     return c
%o A354747 print([a(n) for n in range(1, 88)]) # _Michael S. Branicky_, Jun 06 2022
%Y A354747 Cf. A016789, A050412, A354748.
%K A354747 nonn
%O A354747 1,6
%A A354747 _Felix Fröhlich_, Jun 06 2022