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-4 of 4 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

A277891 a(n) = number of odd numbers encountered before reaching (n^2)-1 when starting from k = ((n+1)^2)-1 and iterating map k -> k - A002828(k).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Nov 08 2016

Keywords

Comments

The starting point ((n+1)^2)-1 of the iteration is included if it is odd, but the ending point (n^2)-1 is never included in the count.
a(n) = number of odd numbers on row n of A276574, after the initial zero-row.
On the average, the odd terms in A276573 (A276574) seem to occur more frequently than the even terms. (The last point in range 1..10000 where a(n) <= A277890(n) is n=862). See also comments in A277487 and the plot of ratio a(n)/A277890(n), also the plot of A277889.

Examples

			For n=6, we start iterating from k = ((6+1)^2)-1 = 48, with k -> k - A002828(k), to obtain 48 -> 45 -> 43 -> 40 -> 38 before reaching 35 (which is 6^2 - 1, an ending point and thus not included in the count), and the only odd numbers before that were 45 and 43, thus a(6) = 2.
		

Crossrefs

Programs

  • PARI
    istwo(n:int)=my(f); if(n<3, return(n>=0); ); f=factor(n>>valuation(n, 2)); for(i=1, #f[, 1], if(bitand(f[i, 2], 1)==1&&bitand(f[i, 1], 3)==3, return(0))); 1
    isthree(n:int)=my(tmp=valuation(n, 2)); bitand(tmp, 1)||bitand(n>>tmp, 7)!=7
    A002828(n)=if(issquare(n), !!n, if(istwo(n), 2, 4-isthree(n))) \\ From Charles R Greathouse IV, Jul 19 2011
    A277891(n) = { my(orgk = ((n+1)^2)-1); my(k = orgk, s = 0); while(((k == orgk) || !issquare(1+k)), s = s + (k%2); k = k - A002828(k)); s; };
    for(n=1, 10000, write("b277891.txt", n, " ", A277891(n)));
    
  • Scheme
    (define (A277891 n) (let ((org_k (- (A000290 (+ 1 n)) 1))) (let loop ((k org_k) (s 0)) (if (and (< k org_k) (= 1 (A010052 (+ 1 k)))) s (loop (- k (A002828 k)) (+ s (A000035 k)))))))

Formula

a(n) + A277890(n) = A260734(n).
a(n) >= A277487(n).

A277191 Number of integers k in range [n^2, ((n+1)^2)-1] for which the least number of squares that add up to k (A002828) is odd.

Original entry on oeis.org

0, 2, 2, 4, 5, 5, 7, 7, 9, 10, 10, 13, 12, 15, 16, 15, 18, 19, 20, 20, 24, 21, 25, 26, 26, 27, 30, 30, 31, 33, 33, 33, 37, 37, 38, 40, 42, 41, 43, 44, 46, 46, 48, 47, 51, 50, 51, 55, 53, 56, 57, 58, 61, 61, 64, 61, 63, 66, 69, 65, 68, 71, 73, 70, 74, 75, 76, 77, 79, 79, 81, 85, 80, 86, 85, 85, 89, 90, 91, 91, 92, 95, 95, 98, 95, 100
Offset: 0

Views

Author

Antti Karttunen, Oct 04 2016

Keywords

Crossrefs

After the initial zero, one more than A277193.

Programs

  • Scheme
    (define (A277191 n) (add (lambda (i) (A000035 (A002828 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)))))))

Formula

a(n) = Sum_{i=n^2 .. ((n+1)^2)-1} A000035(A002828(i)).
For all n >= 0, a(n) + A277192(n) = 2n+1.
For all n >= 1, a(n) = 1 + A277193(n).

A277194 Number of integers k in range [n^2, ((n+1)^2)-1] for which 4 = the least number of squares that add up to k (A002828).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Oct 04 2016

Keywords

Crossrefs

Programs

  • Scheme
    (define (A277194 n) (add A072401 (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)))))))

Formula

a(n) = Sum_{i=n^2 .. ((n+1)^2)-1} A072401(i).
Other identities.
For n >= 0, 1 + A077773(n) + A277193(n) + a(n) = 2n+1.
For n >= 1, A277192(n) = A077773(n) + a(n).
Showing 1-4 of 4 results.