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.

A381368 a(n) is the least k > n for which prime(n) + prime(k) is a square.

Original entry on oeis.org

4, 6, 5, 10, 16, 9, 8, 102, 13, 20, 30, 28, 17, 26, 16, 58, 33, 23, 55, 21, 54, 142, 30, 28, 49, 48, 139, 35, 91, 47, 45, 44, 56, 135, 54, 40, 39, 252, 51, 49, 78, 128, 62, 76, 75, 126, 245, 71, 55, 69, 54, 68, 120, 137, 81, 65, 63, 238, 171, 96, 62, 76, 108, 209
Offset: 1

Views

Author

Felix Huber, Mar 02 2025

Keywords

Comments

Least k > n for which A000040(n) + A000040(k) is a term of A000290.
a(1) = 1 if k = n were also permitted. All other terms would remain unchanged.

Examples

			a(2) = 6 because prime(2) + prime(6) = 3 + 13 = 4^2 and 3 + 5, 3 + 7, 3 + 11 are not squares.
		

Crossrefs

Programs

  • Maple
    A381368:=proc(n)
        local k;
            for k from n+1 do
                if issqr(ithprime(n)+ithprime(k)) then
                    return k
                fi
            od
    end proc;
    seq(A381368(n),n=1..64);
  • Mathematica
    a[n_]:=Module[{k=n+1},While[!IntegerQ[Sqrt[Prime[n]+Prime[k]]], k++]; k]; Array[a,64] (* Stefano Spezia, Mar 02 2025 *)
  • PARI
    a(n) = my(k=n+1, q=prime(n+1), p=prime(n)); while (!issquare(p+q), k++;q=nextprime(q+1)); k; \\ Michel Marcus, Mar 02 2025

Formula

a(n) = A000720(A259232(n)). - Michel Marcus, Mar 02 2025