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.

A363763 a(n) is the least k such that there are exactly n distinct numbers j that can be expressed as the sum of two squares with k^2 < j < (k+1)^2, or -1 if such a k does not exist.

This page as a plain text file.
%I A363763 #73 Aug 06 2023 04:08:11
%S A363763 0,1,2,4,5,7,8,10,13,12,15,17,19,23,21,24,25,28,32,31,34,37,39,44,41,
%T A363763 43,45,50,51,48,57,55,56,59,64,63,68,69,74,77,78,75,72,80,88,84,-1,94,
%U A363763 89,96,93,99,97,102,108,-1,106,111,110,113,117,120,-1,123,133,127,130,137,142,138,139,-1,135
%N A363763 a(n) is the least k such that there are exactly n distinct numbers j that can be expressed as the sum of two squares with k^2 < j < (k+1)^2, or -1 if such a k does not exist.
%C A363763 Index of first occurrence of n in A077773 if there is any, otherwise -1. - _Rainer Rosenthal_, Jul 07 2023
%H A363763 Hugo Pfoertner, <a href="/A363763/a363763.gp.txt">PARI program for calculating a single term</a>, Jul 2023.
%H A363763 Rainer Rosenthal, <a href="/A363763/a363763.png">Illustrating a(5) = 7</a>.
%H A363763 Rainer Rosenthal, <a href="/A363763/a363763_1.png">First terms of A363763 illustrated</a>.
%F A363763 If a(n) != -1, then a(n) >= n/2. - _Chai Wah Wu_, Jun 22 2023
%F A363763 a(n) < (n+1)^2/2. - _Jon E. Schoenfield_ and _Chai Wah Wu_, Jun 24-26 2023
%e A363763 From _Rainer Rosenthal_, Jul 09 2023: (Start)
%e A363763 a(5) = 7, since A077773(7) = 5 and A077773(n) != 5 for n < 7.
%e A363763 a(46) = -1, since a(46) < ((46+1)^2)/2 < 1105 and A077773(k) != 46 for all k < 1105.
%e A363763 See illustrations in the links section. (End)
%o A363763 (PARI) \\ a4018(n) after _Michael Somos_
%o A363763 a4018(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)));
%o A363763 a363763 (upto) = {for (n=0, upto, my(kfound=-1); for (k=0, (n+1)^2\2+1, my(kp=k^2+1, km=(k+1)^2-1, m=0); for (j=kp, km, if (a4018(j), m++); if (m>n, break)); if (m==n, kfound=k; break)); print1 (kfound,", ");)};
%o A363763 a363763(75)
%o A363763 (Python)
%o A363763 from sympy import factorint
%o A363763 def A363763(n):
%o A363763     for k in range(n>>1,((n+1)**2<<1)+1):
%o A363763         c = 0
%o A363763         for m in range(k**2+1,(k+1)**2):
%o A363763             if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items()):
%o A363763                 c += 1
%o A363763                 if c>n:
%o A363763                     break
%o A363763         if c==n:
%o A363763             return k
%o A363763     return -1 # _Chai Wah Wu_, Jun 20-26 2023
%Y A363763 Cf. A000415, A001481, A004018, A077773, A364341.
%Y A363763 A363762 gives the positions of terms = -1.
%Y A363763 Identical with A363761 up to a(11459) = 33864, but increasingly different afterwards, i.e., a(11460) = 34451, whereas A363761(11460) = -1.
%K A363763 sign
%O A363763 0,3
%A A363763 _Hugo Pfoertner_, Jun 20 2023