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.

Showing 1-7 of 7 results.

A077773 Number of integers between n^2 and (n+1)^2 that are the sum of two squares; multiple representations are counted once.

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 6, 9, 8, 8, 10, 10, 11, 11, 12, 11, 14, 12, 13, 15, 16, 15, 15, 17, 16, 17, 19, 18, 19, 20, 19, 20, 21, 20, 22, 22, 24, 22, 25, 23, 26, 26, 24, 29, 26, 27, 28, 27, 29, 26, 31, 32, 30, 29, 33, 33, 31, 31, 35, 34, 35, 35, 35, 36, 37, 37, 33, 42, 37, 38
Offset: 0

Views

Author

T. D. Noe, Nov 20 2002

Keywords

Comments

Related to the circle problem, cf. A077770. See A077774 for a more restrictive case. A077768 counts the representations multiply.
Number of integers k in range [n^2, ((n+1)^2)-1] for which 2 = the least number of squares that add up to k (A002828). Because of this interpretation a(0)=0 was prepended to the beginning. - Antti Karttunen, Oct 04 2016
This sequence is not surjective, since, for instance, there is no n such that a(n) = 46. This follows from a bound observed by Jon E. Schoenfield, that if a(n) = m then n < ((m+1)^2)/2, and the fact that a(n) != 46 for all n < 1105. - Rainer Rosenthal, Jul 25 2023

Examples

			a(8)=6 because 65=64+1=49+16, 68=64+4, 72=36+36, 73=64+9, 74=49+25 and 80=64+16 are between squares 64 and 81. Note that 65 is counted only once.
		

Crossrefs

Cf. A363762 (terms not occurring in this sequence), A363763.

Programs

  • Mathematica
    maxN=100; lst={}; For[n=1, n<=maxN, n++, sqrs={}; i=n; j=0; While[i>=j, j=1; While[i^2+j^2<(n+1)^2, If[i>=j&&i^2+j^2>n^2, AppendTo[sqrs, i^2+j^2]]; j++ ]; i--; j-- ]; AppendTo[lst, Length[Union[sqrs]]]]; lst
  • PARI
    a(N)=s=0;for(n=N^2+1,(N+1)^2-1,f=0;r=sqrtint(n);forstep(i=r,1,-1,if(issquare(n-i*i),f=1;s=s+1;break)));s /* Ralf Stephan, Sep 17 2013 */
    
  • Python
    from sympy import factorint
    def A077773(n): return sum(1 for m in range(n**2+1,(n+1)**2) if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items())) # Chai Wah Wu, Jun 20 2023
  • Scheme
    (define (A077773 n) (add (lambda (i) (* (- 1 (A010052 i)) (A229062 i))) (A000290 n) (+ -1 (A000290 (+ 1 n)))))
    ;; Implements sum_{i=lowlim..uplim} intfun(i)
    (define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
    ;; Antti Karttunen, Oct 04 2016
    

Formula

a(n) = Sum_{i=n^2+1..(n+1)^2-1} A229062(i). - Ralf Stephan, Sep 17 2013
From Antti Karttunen, Oct 04 2016: (Start)
For n >= 0, a(n) + A277193(n) + A277194(n) = 2n.
For n >= 1, A277192(n) = a(n) + A277194(n). (End)

Extensions

Term a(0)=0 prepended by Antti Karttunen, Oct 04 2016

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.

Original entry on oeis.org

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, 43, 45, 50, 51, 48, 57, 55, 56, 59, 64, 63, 68, 69, 74, 77, 78, 75, 72, 80, 88, 84, -1, 94, 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
Offset: 0

Views

Author

Hugo Pfoertner, Jun 20 2023

Keywords

Comments

Index of first occurrence of n in A077773 if there is any, otherwise -1. - Rainer Rosenthal, Jul 07 2023

Examples

			From _Rainer Rosenthal_, Jul 09 2023: (Start)
a(5) = 7, since A077773(7) = 5 and A077773(n) != 5 for n < 7.
a(46) = -1, since a(46) < ((46+1)^2)/2 < 1105 and A077773(k) != 46 for all k < 1105.
See illustrations in the links section. (End)
		

Crossrefs

A363762 gives the positions of terms = -1.
Identical with A363761 up to a(11459) = 33864, but increasingly different afterwards, i.e., a(11460) = 34451, whereas A363761(11460) = -1.

Programs

  • PARI
    \\ a4018(n) after Michael Somos
    a4018(n) = if( n<1, n==0, 4 * sumdiv( n, d, (d%4==1) - (d%4==3)));
    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,", ");)};
    a363763(75)
    
  • Python
    from sympy import factorint
    def A363763(n):
        for k in range(n>>1,((n+1)**2<<1)+1):
            c = 0
            for m in range(k**2+1,(k+1)**2):
                if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items()):
                    c += 1
                    if c>n:
                        break
            if c==n:
                return k
        return -1 # Chai Wah Wu, Jun 20-26 2023

Formula

If a(n) != -1, then a(n) >= n/2. - Chai Wah Wu, Jun 22 2023
a(n) < (n+1)^2/2. - Jon E. Schoenfield and Chai Wah Wu, Jun 24-26 2023

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.

Original entry on oeis.org

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, 43, 45, 50, 51, 48, 57, 55, 56, 59, 64, 63, 68, 69, 74, 77, 78, 75, 72, 80, 88, 84, -1, 94, 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
Offset: 0

Views

Author

Hugo Pfoertner, Jun 22 2023

Keywords

Crossrefs

Identical with A363763 for n <= 11459, but increasingly different afterwards, i.e., a(11460) = -1, whereas A363763(11460) = 34451.

Programs

  • PARI
    a363761(upto) = {for (n=0, upto, my(kfound=-1);
    for (k=0, 3*n, my(k1=k^2+1, k2=k*(k+2), m=0);
    for (j=k1, k2, m+= (sumdiv(j,d, (d%4==1)-(d%4==3))>0); if (m>n, break));
    if (m==n, kfound=k; break); if (m==n, kfound=k; break)); print1(kfound,", "))};
    a363761(75)
    
  • Python
    from sympy import factorint
    def A363761(n):
        for k in range(n>>1,3*n):
            c = 0
            for m in range(k**2+1,(k+1)**2):
                if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items()):
                    c += 1
                    if c>n:
                        break
            if c==n:
                return k
        return -1 # Chai Wah Wu, Jun 22 2023

Formula

If a(n) != -1, then a(n) >= n/2. - Chai Wah Wu, Jun 22 2023
a(n) = A363763(n) for n <= 11459.
a(n) = -1 for n > 15898.

A364729 Complement of A364443.

Original entry on oeis.org

15, 23, 45, 53, 66, 78, 136, 144, 162, 184, 191, 208, 261, 265, 269, 310, 337, 458, 476, 539, 550, 557, 594, 614, 667, 681, 766, 772, 785, 806, 808, 863, 870, 879, 896, 910, 923, 927, 942, 975, 992, 1012, 1013, 1050, 1053, 1066, 1071, 1154, 1193, 1223, 1254, 1271
Offset: 1

Views

Author

Hugo Pfoertner, Aug 06 2023

Keywords

Crossrefs

Formula

A364730(a(n)) = 0.
A364731(a(n)) = A364732(a(n)) = -1.

A363522 Number of integers k such that there are exactly n distinct numbers j with k^2 < j < (k+1)^2 which can be expressed as sum of two squares.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 3, 1, 2, 1, 2, 3, 2, 1, 1, 3, 2, 2, 1, 3, 3, 1, 3, 1, 2, 1, 4, 2, 1, 3, 1, 3, 1, 3, 1, 4, 1, 3, 2, 1, 1, 4, 1, 4, 2, 3, 0, 2, 3, 3, 3, 2, 2, 2, 1, 0, 3, 5, 1, 4, 1, 4, 0, 2, 2, 3, 4, 1, 1, 3, 3, 0, 5, 1, 4, 1, 2, 1, 3, 4, 0, 3, 3, 2, 2, 4, 0, 3
Offset: 0

Views

Author

Rainer Rosenthal, Jul 07 2023

Keywords

Comments

Number of occurrences of n in A077773.

Examples

			a(0) = 1, since A077773(k) = 0 at the single index k = 0.
a(6) = 3, since A077773(k) = 6 for these 3 indices: k = 8, 9, and 11.
a(46) = 0, since A077773 doesn't contain 46; see A363761, A363762 and A363763.
		

Crossrefs

Programs

  • Python
    from sympy import factorint
    def A363522(n):
        s = 0
        for k in range(n>>1,((n+1)**2<<1)+1):
            c = 0
            for m in range(k**2+1,(k+1)**2):
                if all(p==2 or p&3==1 or e&1^1 for p, e in factorint(m).items()):
                    c += 1
                    if c>n:
                        break
            if c==n:
                s += 1
        return s # Chai Wah Wu, Jul 10 2023

A364445 Complement of A364444.

Original entry on oeis.org

1, 4, 6, 9, 12, 13, 17, 19, 21, 25, 26, 28, 32, 33, 35, 37, 39, 41, 43, 45, 46, 50, 52, 53, 56, 59, 60, 63, 64, 66, 68, 70, 72, 74, 77, 79, 80, 82, 84, 86, 88, 90, 92, 93, 96, 98, 99, 102, 105, 106, 108, 112, 113, 116, 118, 119, 120, 123, 124, 127, 129, 132, 133
Offset: 1

Views

Author

Hugo Pfoertner, Aug 01 2023

Keywords

Comments

Compared to A364444, this sequence is what A363762 is to A077773.

Crossrefs

Programs

  • Python
    from itertools import count, islice
    def A364445_gen(): # generator of terms
        a = 0
        for n in count(1):
            b = sum(1 for k in range(n**2+1,(n+1)**2) if (m:=(~k&k-1).bit_length())&1 or (k>>m)&7<7)
            yield from range(a+1,b)
            a = b
    A364445_list = list(islice(A364445_gen(),20)) # Chai Wah Wu, Aug 01 2023

A385754 Positive numbers not occurring in A384797.

Original entry on oeis.org

1, 6, 16, 20, 25, 30, 33, 41, 48, 53, 57, 59, 62, 67, 74, 75, 78, 86, 90, 93, 98, 100, 107, 110, 113, 114, 123, 128, 130, 135, 138, 142, 145, 151, 153, 157, 159, 162, 165, 168, 178, 183, 191, 202, 204, 211, 212, 220, 223, 229, 232, 245, 254, 255, 283, 286, 291, 301
Offset: 1

Views

Author

Hugo Pfoertner, Jul 08 2025

Keywords

Comments

This sequence is to A384797 what A363762 is to A077773.

Crossrefs

Showing 1-7 of 7 results.