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.

A385967 Smallest nonnegative integer whose square is the sum of the squares of A047432(n) distinct primes.

This page as a plain text file.
%I A385967 #10 Jul 20 2025 17:42:30
%S A385967 0,2,18,16,27,52,54,102,96,103,152,142,218,216,225,288,282,366,352,
%T A385967 387,440,474,558,528,559,648,626,758,780,783,900,858,978,976,1047,
%U A385967 1112,1146,1290,1248,1285,1404,1394,1550,1584,1587,1764,1710,1866,1868,1959,2048
%N A385967 Smallest nonnegative integer whose square is the sum of the squares of A047432(n) distinct primes.
%C A385967 Terms are odd when n is a multiple of 5, and even otherwise.
%C A385967 a(10) = 103 is also the smallest number whose square is the sum of the squares of at least 2 distinct primes and which itself is also a prime.
%C A385967 From _David A. Corneth_, Jul 14 2025: (Start)
%C A385967 If A047432(n) is a multiple of 4 then 4 cannot be one of the squares of primes in the sum. Proof: If 4 is there the sum of squares mod 4 will be 3 (mod 4) in that case. No square is 3 (mod 4). A contradiction.
%C A385967 If A047432(n) is a multiple of 3 then 9 cannot be one of the squares of primes in the sum. Proof: If 9 is there then the sum of squares will be 2 (mod 3) in that case. No square is 2 (mod 3). A contradiction. (End)
%e A385967 a(5) = 27 because prime count A047432(5) = 6 and the smallest sum of squares of 6 distinct primes that is a square is 19^2 + 13^2 + 11^2 + 7^2 + 5^2 + 2^2 = 27^2.
%o A385967 (PARI) a(n, c1=0, c2=0, c3=0, ~r, ~pc)={if(c1==0, n--; my(n5=n%5); n=(n-n5)/5*8+n5+if(n5>=2, 2, 0); r=[oo]; pc=vector(max(n-1, 0)); for(i=1, #pc, pc[i]=if(i>1, pc[i-1], 0)+prime(i)^2)); if(c1==n, return(if(issquare(c3), c3, oo))); for(i=n-c1, if(c1, c2-1, oo), my(p2=prime(i)^2); if(c3+p2+if(n-c1-1>0, pc[n-c1-1], 0)>=r[1], break); r[1]=min(r[1], a(n, c1+1, i, c3+p2, ~r, ~pc))); if(c1, r[1], sqrtint(r[1]))}
%Y A385967 Cf. A047432, A018935.
%K A385967 nonn
%O A385967 1,2
%A A385967 _Charles L. Hohn_, Jul 13 2025