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.

A363761 a(n) is the least k < 3*n such that there are exactly n distinct numbers j that can be expressed as 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 A363761 #19 Jul 03 2023 08:01:58
%S A363761 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 A363761 43,45,50,51,48,57,55,56,59,64,63,68,69,74,77,78,75,72,80,88,84,-1,94,
%U A363761 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 A363761 a(n) is the least k < 3*n such that there are exactly n distinct numbers j that can be expressed as sum of two squares with k^2 < j < (k+1)^2, or -1 if such a k does not exist.
%H A363761 Hugo Pfoertner, <a href="/A363761/b363761.txt">Table of n, a(n) for n = 0..3000</a>
%F A363761 If a(n) != -1, then a(n) >= n/2. - _Chai Wah Wu_, Jun 22 2023
%F A363761 a(n) = A363763(n) for n <= 11459.
%F A363761 a(n) = -1 for n > 15898.
%o A363761 (PARI) a363761(upto) = {for (n=0, upto, my(kfound=-1);
%o A363761 for (k=0, 3*n, my(k1=k^2+1, k2=k*(k+2), m=0);
%o A363761 for (j=k1, k2, m+= (sumdiv(j,d, (d%4==1)-(d%4==3))>0); if (m>n, break));
%o A363761 if (m==n, kfound=k; break); if (m==n, kfound=k; break)); print1(kfound,", "))};
%o A363761 a363761(75)
%o A363761 (Python)
%o A363761 from sympy import factorint
%o A363761 def A363761(n):
%o A363761     for k in range(n>>1,3*n):
%o A363761         c = 0
%o A363761         for m in range(k**2+1,(k+1)**2):
%o A363761             if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items()):
%o A363761                 c += 1
%o A363761                 if c>n:
%o A363761                     break
%o A363761         if c==n:
%o A363761             return k
%o A363761     return -1 # _Chai Wah Wu_, Jun 22 2023
%Y A363761 Cf. A001481, A004018, A077773, A363762.
%Y A363761 Identical with A363763 for n <= 11459, but increasingly different afterwards, i.e., a(11460) = -1, whereas A363763(11460) = 34451.
%K A363761 sign
%O A363761 0,3
%A A363761 _Hugo Pfoertner_, Jun 22 2023