login
Array read by antidiagonals, m, n >= 1: T(m,n) is the position of the first prime (after the two initial terms) in the Fibonacci-like sequence with initial terms m and n, or 0 if no such prime exists.
2

%I #10 Sep 20 2021 11:50:03

%S 2,2,2,3,0,3,2,2,2,2,3,0,0,0,3,2,2,2,2,2,2,4,0,3,0,3,0,4,3,5,0,4,3,0,

%T 3,4,3,0,3,0,0,0,3,0,3,2,2,2,2,2,2,2,2,2,2,3,0,0,0,3,0,3,0,0,0,3,2,2,

%U 2,2,2,2,2,2,2,2,2,2,4,0,6,0,3,0,0,0,3,0,3,0,4

%N Array read by antidiagonals, m, n >= 1: T(m,n) is the position of the first prime (after the two initial terms) in the Fibonacci-like sequence with initial terms m and n, or 0 if no such prime exists.

%C There are cases where T(m,n) = 0 even when m and n are coprime; see A082411, A083104, A083105, A083216, and A221286.

%C The largest value of T(m,n) for m, n <= 5000 is T(1591,300) = 17262.

%F T(m,n) = 0 if m and n have a common factor.

%F T(m,n) = T(n,m+n) + 1 if m+n is not prime, otherwise T(m,n) = 2.

%e Array begins:

%e m\n| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

%e ---+------------------------------------------------------------

%e 1 | 2 2 3 2 3 2 4 3 3 2 3 2 4 3 3 2 4 2 4 3

%e 2 | 2 0 2 0 2 0 5 0 2 0 2 0 4 0 2 0 2 0 4 0

%e 3 | 3 2 0 2 3 0 3 2 0 2 6 0 3 2 0 2 3 0 3 2

%e 4 | 2 0 2 0 4 0 2 0 2 0 4 0 2 0 2 0 4 0 2 0

%e 5 | 3 2 3 3 0 2 3 2 3 0 4 2 3 2 0 3 4 2 3 0

%e 6 | 2 0 0 0 2 0 2 0 0 0 2 0 2 0 0 0 2 0 5 0

%e 7 | 4 3 3 2 3 2 0 3 4 2 3 2 4 0 3 2 3 3 4 3

%e 8 | 4 0 2 0 2 0 4 0 2 0 2 0 5 0 2 0 4 0 4 0

%e 9 | 3 2 0 2 3 0 3 2 0 2 3 0 6 2 0 3 3 0 3 2

%e 10 | 2 0 2 0 0 0 2 0 2 0 4 0 2 0 0 0 4 0 2 0

%e 11 | 3 2 3 3 4 2 4 2 3 3 0 2 3 5 3 3 4 2 4 2

%e 12 | 2 0 0 0 2 0 2 0 0 0 2 0 5 0 0 0 2 0 2 0

%e 13 | 4 3 3 2 3 2 4 3 3 2 4 3 0 3 3 2 3 2 4 3

%e 14 | 4 0 2 0 2 0 0 0 2 0 4 0 4 0 2 0 2 0 5 0

%e 15 | 3 2 0 2 0 0 3 2 0 0 3 0 3 2 0 2 6 0 3 0

%e 16 | 2 0 2 0 4 0 2 0 4 0 5 0 2 0 2 0 4 0 4 0

%e 17 | 3 2 3 5 10 2 3 6 4 3 4 2 3 2 3 5 0 3 7 2

%e 18 | 2 0 0 0 2 0 5 0 0 0 2 0 2 0 0 0 5 0 2 0

%e 19 | 4 3 4 2 3 3 4 5 3 2 3 2 6 3 4 5 3 2 0 3

%e 20 | 4 0 2 0 0 0 4 0 2 0 2 0 4 0 0 0 2 0 4 0

%e T(2,7) = 5, because 5 is the smallest k >= 2 for which A022113(k) is prime.

%o (Python)

%o # Note that in the (rare) case when m and n are coprime but there are no primes in the Fibonacci-like sequence, this function will go into an infinite loop.

%o from sympy import isprime,gcd

%o def A347905(m,n):

%o if gcd(m,n) != 1:

%o return 0

%o m,n = n,m+n

%o k=2

%o while not isprime(n):

%o m,n = n,m+n

%o k += 1

%o return k

%Y Cf. A022113, A082411, A083104, A083105, A083216, A221286, A347904.

%K nonn,tabl

%O 1,1

%A _Pontus von Brömssen_, Sep 18 2021