login
A357124
a(n) is the least k >= 1 such that A000045(n) + k*A000032(n) is prime, or -1 if there is no such k.
1
1, 1, 2, -1, 2, 6, -1, 2, 8, -1, 4, 2, -1, 6, 2, -1, 10, 4, -1, 20, 2, -1, 4, 44, -1, 4, 56, -1, 8, 22, -1, 12, 16, -1, 10, 2, -1, 34, 8, -1, 8, 16, -1, 26, 10, -1, 10, 14, -1, 60, 4, -1, 14, 28, -1, 32, 16, -1, 8, 20, -1, 66, 44, -1, 74, 12, -1, 110, 40, -1, 48, 6, -1, 10, 4, -1, 32, 34, -1, 62
OFFSET
0,3
COMMENTS
a(n) = -1 if n > 0 is divisible by 3, as A000045(n) and A000032(n) are both even.
If n is not divisible by 3, A000032(n) and A000045(n) are coprime, so Dirichlet's theorem implies A000032(n) + k*A000045(n) is prime for infinitely many k.
a(n) is even if n > 1 is not divisible by 3, since A000045(n) and A000032(n) are both odd.
LINKS
EXAMPLE
a(4) = 2 because A000032(4) = 7 and A000045(4) = 3, and 7+2*3 = 13 is prime while 7+1*3 = 10 is not prime.
MAPLE
F:= combinat:-fibonacci:
L:= n -> 2*F(n+1)-F(n):
f:= proc(n) local a, b, k;
if n mod 3 = 0 then return -1 fi;
a:= F(n); b:= L(n);
for k from 2 by 2 do
if isprime(a+k*b) then return k fi
od
end proc:
f(0):= 1: f(1):= 1:
map(f, [$0..100]);
MATHEMATICA
a={}; nmax=79; For[n=0, n<=nmax, n++, If[n>0 && Divisible[n, 3], AppendTo[a, -1], For[k=1, k>0, k++, If[PrimeQ[Fibonacci[n]+k LucasL[n]], AppendTo[a, k]; k=-1]]]]; a(* Stefano Spezia, Sep 15 2022 *)
PROG
(Python)
from sympy import fibonacci as A000045, lucas as A000032, isprime
def A357124(n):
if n == 0: return 1
elif n % 3 == 0: return -1
k = 1
while not isprime(A000045(n) + k * A000032(n)): k += 1
return k # Karl-Heinz Hofmann, Sep 15 2022
CROSSREFS
Sequence in context: A096179 A361834 A166350 * A210227 A208757 A361830
KEYWORD
sign
AUTHOR
J. M. Bergot and Robert Israel, Sep 13 2022
STATUS
approved