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.

Showing 1-2 of 2 results.

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

Original entry on oeis.org

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, 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, 4, 3, 1, 0, 1, 0, 5, 6, 4, 3, 1, 0, 4, 3, 1, 0, 5, 12, 4
Offset: 0

Views

Author

Pontus von Brömssen, Mar 28 2023

Keywords

Comments

Suggested by A361509.
2 does not appear because A000045(1) = A000045(2).
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.
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.

Examples

			The first Fibonacci number F such that 25+F is prime is F = 34 = A000045(9), so a(25) = 9.
		

Crossrefs

Cf. A000045, A067760, A322004 (negative n), A361509, A361510, A361997 (records), A361998 (indices of records), A361999 (first occurrences).

Programs

  • Mathematica
    a[n_] := Module[{k = 0}, While[! PrimeQ[n + Fibonacci[k]], k++]; k]; Array[a, 100, 0] (* Amiram Eldar, Mar 30 2023 *)
  • PARI
    a(n) = my(k=0); while (!isprime(n+fibonacci(k)), k++); k; \\ Michel Marcus, Mar 30 2023
  • Python
    from sympy import isprime,fibonacci
    from itertools import count
    def A361902(n):
        # Note: the function hangs if a(n) = -1.
        return next(k for k in count() if isprime(n+fibonacci(k)))
    

Formula

a(n) = 0 if and only if n is prime.
a(n) = -1 if n == 14475 (mod m), where m = 2*3*5*7*11*23*31 = 1647030 (see Gerbicz link).

A363536 a(n) is the smallest k such that A363533(k) = n, or -1 if no such k exists.

Original entry on oeis.org

1, -1, 3, 24, 38, 17, 142, 248, 7, 328, 528, 67, 446, 1676, 31, 208, 1828, 25, 656, 788, 203, 4700, 1678, 47, 5368, 1270, 87, 2992, 10712, 317, 12034, 9262, 121, 5248, 11744, 61, 2798, 19598, 481, 3628, 8956, 181, 4388, 18694, 383, 22754, 23836, 43, 8212, 34636
Offset: 1

Views

Author

Pontus von Brömssen, Jun 09 2023

Keywords

Crossrefs

Showing 1-2 of 2 results.