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.

A381334 Smallest integer that is the sum of a prime and the square of a prime in exactly n ways.

This page as a plain text file.
%I A381334 #16 Feb 25 2025 01:56:05
%S A381334 6,11,56,176,188,362,398,668,1568,1448,1592,2390,3372,3632,4532,6888,
%T A381334 6342,8582,6368,10632,13002,12920,12942,19502,23168,26990,26292,25038,
%U A381334 25472,33648,32238,41048,40640,39800,53360,64998,77348,74718,72740,81542,89682,82880
%N A381334 Smallest integer that is the sum of a prime and the square of a prime in exactly n ways.
%C A381334 Subsequence of A081053. All terms are even except for a(2) = 11.
%C A381334 a(n) >= A381333(n).
%H A381334 Robert Israel, <a href="/A381334/b381334.txt">Table of n, a(n) for n = 1..564</a>
%e A381334 a(1) = 6 as 6 = 2 + 2^2.
%e A381334 a(2) = 11 as 11 = 7 + 2^2 = 2 + 3^2.
%e A381334 a(3) = 56 as 56 = 47 + 3^2 = 31 + 5^2 = 7 + 7^2.
%e A381334 a(4) = 176 as 176 = 167 + 3^2 = 151 + 5^2 = 127 + 7^2 = 7 + 13^2.
%e A381334 a(5) = 188 as 188 = 179 + 3^2 = 163 + 5^2 = 139 + 7^2 = 67 + 11^2 = 19 + 13^2.
%e A381334 a(6) = 362 as 362 = 353 + 3^2 = 337 + 5^2 = 313 + 7^2 = 241 + 11^2 = 193 + 13^2 = 73 + 17^2.
%e A381334 a(9) = 1568 as 1568 = 1559 + 3^2 = 1543 + 5^2 = 1447 + 11^2 = 1399 + 13^2 = 1279 + 17^2 = 1039 + 23^2 = 727 + 29^2 = 607 + 31^2 = 199 + 37^2.
%e A381334 Note that a(9) > A381333(9) = 1448 as 1448 has 10 decompositions: 1448 = 1439 + 3^2 = 1423 + 5^2 = 1399 + 7^2 = 1327 + 11^2 = 1279 + 13^2 = 1087 + 19^2 = 919 + 23^2 = 607 + 29^2 = 487 + 31^2 = 79 + 37^2.
%p A381334 N:= 10^6: # for a(1)..a(k) where a(k+1) is the first term > N
%p A381334 P:= select(isprime,[2,seq(i,i=3..N,2)]):
%p A381334 W:= Vector(1..N/2,datatype=integer[4]):
%p A381334 for i from 2 while P[i]^2 < N do
%p A381334 m:= ListTools:-BinaryPlace(P, N - P[i]^2);
%p A381334 J:= (P[2..m] +~ P[i]^2)/~ 2;
%p A381334   W[J]:= W[J] +~ 1;
%p A381334 od:
%p A381334 imax:= max[index](W):
%p A381334 R:= Vector(W[imax]):
%p A381334 R[1]:= 6: R[2]:= 11:
%p A381334 for i from 1 to imax do
%p A381334 r:= W[i];
%p A381334 if r > 0 and R[r] = 0 then R[r]:= 2*i fi;
%p A381334 od:
%p A381334 if member(0,R,'i') then convert(R[1..i-1],list) else convert(R,list) fi; # _Robert Israel_, Feb 24 2025
%o A381334 (Python)
%o A381334 from itertools import count
%o A381334 from math import isqrt
%o A381334 from sympy import isprime, primerange
%o A381334 def A381334(n): return next(filter(lambda m:sum(1 for p in primerange(isqrt(m)+1) if isprime(m-p**2))==n,count(1)))
%Y A381334 Cf. A081053, A381333.
%K A381334 nonn
%O A381334 1,1
%A A381334 _Chai Wah Wu_, Feb 20 2025