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.

A378898 a(n) is the least k > 0 such that (n+k)^2 + n^2 is prime.

Original entry on oeis.org

1, 1, 5, 1, 1, 5, 1, 5, 1, 3, 3, 1, 7, 1, 7, 3, 1, 5, 1, 3, 5, 1, 7, 1, 1, 5, 5, 5, 1, 1, 13, 1, 7, 1, 1, 13, 3, 7, 1, 3, 3, 1, 5, 5, 7, 3, 1, 5, 25, 1, 5, 5, 5, 5, 3, 5, 11, 5, 5, 1, 3, 3, 17, 7, 1, 5, 13, 27, 1, 1, 13, 1, 27, 5, 19, 9, 3, 5, 1, 9, 19, 1, 5, 1, 1, 9, 1, 15, 7, 1, 3, 3, 5, 5, 7
Offset: 1

Views

Author

Robert Israel, Dec 11 2024

Keywords

Examples

			a(3) = 5 because (3+5)^2 + 3^2 = 73 is prime, and no smaller number works.
		

Crossrefs

Cf. A027861 (a(n) = 1), A089489, A378945, A378946.

Programs

  • Maple
    f:= proc(n) local k;
      for k from n+1 by 2 do
        if igcd(k,n) = 1 and isprime(k^2 + n^2) then return k-n fi
      od
    end proc;
    map(f, [$1..100]);
  • PARI
    a(n) = my(k=1); while (!isprime((n+k)^2 + n^2), k++); k; \\ Michel Marcus, Dec 11 2024

Formula

a(n) = A089489(n) - n.

A378945 Record values in A378898.

Original entry on oeis.org

1, 5, 7, 13, 25, 27, 29, 31, 35, 41, 47, 53, 65, 73, 77, 103, 113, 119, 149, 179, 181, 215, 233, 235, 251, 319, 413, 425, 433, 455, 473, 485, 491, 529, 535, 557, 659, 725
Offset: 1

Views

Author

Robert Israel, Dec 11 2024

Keywords

Comments

Numbers m > 0 such that for some k, (m+k)^2 + k^2 is prime while (m'+k)^2 + k^2 is not prime for 0 < m' < m, and for every k' < k there is m' < m such that (m'+k')^2 + k'^2 is prime.
The values of k are in A378946.

Examples

			a(1) = 1 = A378898(1), as (1+1)^2 + 1^2 = 5 is prime.
a(2) = 5 = A378898(3), as (5+3)^2 + 3^2 = 73 is prime, is the first value of A378898 greater than 1.
a(3) = 7 = A378898(13), as (7+13)^2 + 13^2 = 569 is prime, is the first value of A378898 greater than 5.
		

Crossrefs

Programs

  • Maple
    f:= proc(k) local m;
      for m from 1 by 2 do
        if igcd(m,k) = 1 and isprime((k+m)^2 + k^2) then return m fi
      od
    end proc:
    R:= NULL: count:= 0: rec:= 0:
    for k from 1 while count < 30 do
      v:= f(k);
      if v > rec then
        count:= count+1;
        R:= R, v;
        rec:= v;
      fi
    od:
    R;

Formula

a(n) = A378898(A378946(n)).
Showing 1-2 of 2 results.