%I #25 Jul 27 2024 16:15:30
%S 1,1,2,1,3,1,1,3,3,1,1,2,5,1,3,3,2,2,1,3,1,4,4,1,2,1,5,3,3,1,3,4,1,1,
%T 6,1,1,3,4,1,7,1,2,1,3,2,3,4,3,1,4,1,3,3,2,6,1,7,1,1,2,1,4,4,3,2,2,5,
%U 1,3,5,2,1,4,8,1,2,1,3,2,3,3,4,6,3,4,1,3,3,1,1,7,1,2,1,5,6,1,3,1
%N First differences of sums of two squares.
%C Sequence includes arbitrarily large values as well as infinitely many 1s.
%H Alois P. Heinz, <a href="/A256435/b256435.txt">Table of n, a(n) for n = 1..20000</a>
%H R. P. Bambah and S. Chowla, <a href="https://www.researchgate.net/publication/247014137_On_Numbers_which_can_be_Expressed_as_a_Sum_of_Two_Squares">On numbers which can be expressed as a sum of two squares</a>. Proc. Nat. Inst. Sci. India (1947), 101-103.
%H Rainer Dietmann, Christian Elsholtz, Alexander Kalmynin, Sergei Konyagin, James Maynard, <a href="https://doi.org/10.1093/imrn/rnac130">Longer Gaps Between Values of Binary Quadratic Forms</a>, International Mathematics Research Notices, Volume 2023, Issue 12, June 2023, Pages 10313-10349.
%H P. Erdös, <a href="https://old.renyi.hu/~p_erdos/1951-13.pdf">Some problems and results in elementary number theory</a>, Publ. Math. Debrecen (1951), 103-109.
%H Ian Richards, <a href="https://www.mobt3ath.com/uplode/book/book-93769.pdf?ver=accessable">On the gaps between numbers which are sums of two squares</a>, Adv. in Math. (1982), 1-2.
%F a(n) = A001481(n+1) - A001481(n).
%p b:= proc(n) option remember; local j, k;
%p for k from 1+`if`(n=1, -1, b(n-1)) do
%p for j from 0 to isqrt(iquo(k, 2)) do
%p if issqr(k-j^2) then return k fi
%p od od
%p end:
%p a:= n-> b(n+1)-b(n):
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 29 2015
%t Select[Range[0, 1000], SquaresR[2, #] != 0&] // Differences (* _Jean-François Alcover_, Mar 28 2017 *)
%o (PARI) issum2sq(n) = my(fm=factor(n)); for(k=1,matsize(fm)[1],if(fm[k,1]%4==3&&fm[k,2]%2==1,return(0)));1
%o al(n) = my(r=vector(n),j=0,k=0,last=0); while(k<n,if(issum2sq(j++),r[k++]=j-last;last=j));r
%o (PARI) show(lim)=my(v=vectorsmall(lim\=1),u=List(),t=1); for(m=1,sqrtint(lim), for(n=1,sqrtint(lim-m^2), v[m^2+n^2]=1)); for(i=2,#v, if(v[i], listput(u, i-t); t=i)); Vec(u) \\ _Charles R Greathouse IV_, Mar 31 2015
%Y Cf. A001481 (sums of 2 squares), A005408 (differences between squares).
%K nonn
%O 1,3
%A _Franklin T. Adams-Watters_, Mar 28 2015