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.

A361902 Least k such that n+A000045(k) is prime, or -1 if no such k exists.

This page as a plain text file.
%I A361902 #30 Dec 23 2024 14:53:46
%S A361902 3,1,0,0,1,0,1,0,4,3,1,0,1,0,4,3,1,0,1,0,4,3,1,0,5,9,4,3,1,0,1,0,5,6,
%T A361902 4,3,1,0,4,3,1,0,1,0,4,3,1,0,5,9,4,3,1,0,5,9,4,3,1,0,1,0,5,6,4,3,1,0,
%U A361902 4,3,1,0,1,0,5,6,4,3,1,0,4,3,1,0,5,12,4
%N A361902 Least k such that n+A000045(k) is prime, or -1 if no such k exists.
%C A361902 Suggested by A361509.
%C A361902 2 does not appear because A000045(1) = A000045(2).
%C A361902 When n >= 3 and a(n) != -1, a(n) is divisible by 3 if and only if n is odd, because A000045(k) is even if and only if k is divisible by 3.
%C A361902 The least n for which a(n) = -1 is one of 7123, 11009, and 14475. When n is 7123 or 11009, either a(n) > 60000 or a(n) = -1.
%H A361902 Pontus von Brömssen, <a href="/A361902/b361902.txt">Table of n, a(n) for n = 0..7122</a>
%H A361902 Robert Gerbicz, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/pipermail/seqfan/2023-March/074410.html">Re: Add a Fibonacci number to get a prime</a>, SeqFan mailing list, March 28, 2023.
%F A361902 a(n) = 0 if and only if n is prime.
%F A361902 a(n) = -1 if n == 14475 (mod m), where m = 2*3*5*7*11*23*31 = 1647030 (see Gerbicz link).
%e A361902 The first Fibonacci number F such that 25+F is prime is F = 34 = A000045(9), so a(25) = 9.
%t A361902 a[n_] := Module[{k = 0}, While[! PrimeQ[n + Fibonacci[k]], k++]; k]; Array[a, 100, 0] (* _Amiram Eldar_, Mar 30 2023 *)
%o A361902 (Python)
%o A361902 from sympy import isprime,fibonacci
%o A361902 from itertools import count
%o A361902 def A361902(n):
%o A361902     # Note: the function hangs if a(n) = -1.
%o A361902     return next(k for k in count() if isprime(n+fibonacci(k)))
%o A361902 (PARI) a(n) = my(k=0); while (!isprime(n+fibonacci(k)), k++); k; \\ _Michel Marcus_, Mar 30 2023
%Y A361902 Cf. A000045, A067760, A322004 (negative n), A361509, A361510, A361997 (records), A361998 (indices of records), A361999 (first occurrences).
%K A361902 sign
%O A361902 0,1
%A A361902 _Pontus von Brömssen_, Mar 28 2023