login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A305024 Minimal number of squares, not all equal to 1, having as sum prime(n), such that their squares also sum to a prime; 0 if no such decomposition exists. 1

%I #37 Dec 12 2019 20:12:57

%S 0,0,2,4,3,2,2,3,4,2,4,2,2,3,7,2,5,4,4,4,2,4,3,2,3,3,5,3,4,5,4,3,2,3,

%T 2,4,2,4,4,3,3,2,4,4,4,4,3,4,3,4,3,4,3,3,2,4,2,4,3,2,3,2,4,4,2,4,4,4,

%U 3,2,3,4,4,2,3,4,3,2,2,2,3,2,4,3,4,3,3,4,2,4,3,4,4,3,3

%N Minimal number of squares, not all equal to 1, having as sum prime(n), such that their squares also sum to a prime; 0 if no such decomposition exists.

%C It has been conjectured (cf. A126769) that any prime p >= 5 can be written in a nontrivial way as p = Sum (b_i)^2 such that Sum (b_i)^4 is also prime. This sequence lists the number of required terms b_i for each prime.

%C The two initial zeros say that this decomposition is not possible for prime(1) = 2 and prime(2) = 3, and are thus conjectured to be the only zeros of the sequence. Since we are interested in the minimal number of terms, we can consider only nonzero b_i >= 1 and min{b_i} >= 2 to avoid the trivial solution b_i = 1 for all i <= k = prime(n).

%H Robert Israel, <a href="/A305024/b305024.txt">Table of n, a(n) for n = 1..5000</a>

%F If

%e The first two primes, 2 and 3, cannot be written as a sum of squares not all equal to 1, because the smallest such sum is 1^2 + 2^2 = 5. (The empty sum and a one-term sum of a square cannot be prime, either.) Therefore a(1) = a(2) = 0.

%e The third prime, 5, can be written in exactly one way as a nontrivial sum of two squares, 5 = 1^2 + 2^2, and the sum of the fourth powers is 1^4 + 2^4 = 17, which is again prime. Therefore, a(3) = 2.

%e The fourth prime, 7, cannot be written as sum of 2 or 3 squares, but only 4 squares, as 7 = 1^2 + 1^2 + 1^2 + 2^2, and it turns out that sum of the fourth powers also yields a prime, 1^4 + 1^4 + 1^4 + 2^4 = 19. Therefore, a(4) = 4.

%e prime(15) = 47 = 1^2 + 2^2 + 2^2 + 2^2 + 3^2 + 3^2 + 4^2, and the sum of the fourth powers gives the prime 467. Since no smaller number of terms has this property, a(15) = 7.

%e prime(18) = 61 = 2^2 + 4^2 + 4^2 +5^2, and 2^4 + 4^4 + 4^4 +5^4 = 1153, a prime, and no smaller number of terms has this property, so a(18) = 4.

%e prime(27) = 103 = 1^2 + 4^2 + 5^2 + 5^2 + 6^2 and 1^4 + 4^4 + 5^4 + 5^4 + 6^4 = 2803, a prime, and no smaller number of terms has this property, so a(27) = 5.

%e The values 2, 3, 4, 5 appear for the first time at index n = 3, 5, 4, 17, and a(15) = 7. We don't know when the first 6 occurs, nor whether this happens at all.

%e Conjecture: The sequence is bounded.

%e Is it possible to show that no term of the sequence is larger than 7?

%p repss:= proc(n,k,i) option remember;

%p # lists of k squares >= i^2 summing to n

%p if k = 1 then

%p if issqr(n) and n >= i^2 then {[sqrt(n)]}

%p else {}

%p fi

%p elif n < k then {}

%p else

%p `union`(seq(map(t -> [j,op(t)], procname(n-j^2,k-1,j)),j=i..floor(sqrt(n))))

%p fi

%p end proc:

%p f:= proc(n) local p,k,i,S; global Rep;

%p p:= ithprime(n);

%p for k from 2 do

%p S:= select(t -> isprime(convert(map(`^`,t,4),`+`)), repss(p,k,1));

%p if nops(S) > 0 then Rep[n]:= S[1]; return k fi

%p od

%p end proc:

%p 0,0,seq(f(n),n=3..100); # _Robert Israel_, Dec 12 2019

%t a[n_] := Block[{p = Prime@n, c, k=2}, c = Range[Sqrt[p]]^2; While[ k<p, If[ Select[ IntegerPartitions[ p, {k}, c], PrimeQ@ Total[ #^2] &, 1] != {}, Break[]]; k++]; If[k < p, k, 0]]; Array[a, 95] (* _Giovanni Resta_, Dec 12 2019 *)

%o (PARI) apply( A305024(n)={n=prime(n); for(k=2, n-3, my(s=sqrtint((n-k)\3+1), t);

%o forvec(b=vector(k-2, i, [1,s]), t=vecsum([t^4|t<-b]);

%o for(i=1,#s=sum2sqr(n-norml2(b))/* see A133388 for sum2sqr() */,

%o s[i][1]>0 && isprime(s[i][1]^4+s[i][2]^4+t) && return(k))/*end for i*/

%o , 1/*forvec:increasing*/))}, [1..95]) \\ Bug fixed: _M. F. Hasler_, Dec 12 2019

%Y Cf. A126769, A128292.

%K nonn

%O 1,3

%A _M. F. Hasler_, May 23 2018

%E Corrected by _Robert Israel_, Dec 12 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 14:51 EDT 2024. Contains 371749 sequences. (Running on oeis4.)