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.

This page as a plain text file.
%I A381368 #13 Mar 08 2025 08:47:33
%S A381368 4,6,5,10,16,9,8,102,13,20,30,28,17,26,16,58,33,23,55,21,54,142,30,28,
%T A381368 49,48,139,35,91,47,45,44,56,135,54,40,39,252,51,49,78,128,62,76,75,
%U A381368 126,245,71,55,69,54,68,120,137,81,65,63,238,171,96,62,76,108,209
%N A381368 a(n) is the least k > n for which prime(n) + prime(k) is a square.
%C A381368 Least k > n for which A000040(n) + A000040(k) is a term of A000290.
%C A381368 a(1) = 1 if k = n were also permitted. All other terms would remain unchanged.
%H A381368 Felix Huber, <a href="/A381368/b381368.txt">Table of n, a(n) for n = 1..10000</a>
%F A381368 a(n) = A000720(A259232(n)). - _Michel Marcus_, Mar 02 2025
%e A381368 a(2) = 6 because prime(2) + prime(6) = 3 + 13 = 4^2 and 3 + 5, 3 + 7, 3 + 11 are not squares.
%p A381368 A381368:=proc(n)
%p A381368     local k;
%p A381368         for k from n+1 do
%p A381368             if issqr(ithprime(n)+ithprime(k)) then
%p A381368                 return k
%p A381368             fi
%p A381368         od
%p A381368 end proc;
%p A381368 seq(A381368(n),n=1..64);
%t A381368 a[n_]:=Module[{k=n+1},While[!IntegerQ[Sqrt[Prime[n]+Prime[k]]], k++]; k]; Array[a,64] (* _Stefano Spezia_, Mar 02 2025 *)
%o A381368 (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
%Y A381368 Cf. A000040, A000290, A259232.
%K A381368 nonn,easy
%O A381368 1,1
%A A381368 _Felix Huber_, Mar 02 2025