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-10 of 19 results. Next

A001481 Numbers that are the sum of 2 squares.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 9, 10, 13, 16, 17, 18, 20, 25, 26, 29, 32, 34, 36, 37, 40, 41, 45, 49, 50, 52, 53, 58, 61, 64, 65, 68, 72, 73, 74, 80, 81, 82, 85, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 121, 122, 125, 128, 130, 136, 137, 144, 145, 146, 148, 149, 153, 157, 160
Offset: 1

Views

Author

Keywords

Comments

Numbers n such that n = x^2 + y^2 has a solution in nonnegative integers x, y.
Closed under multiplication. - David W. Wilson, Dec 20 2004
Also, numbers whose cubes are the sum of 2 squares. - Artur Jasinski, Nov 21 2006 (Cf. A125110.)
Terms are the squares of smallest radii of circles covering (on a square grid) a number of points equal to the terms of A057961. - Philippe Lallouet (philip.lallouet(AT)wanadoo.fr), Apr 16 2007. [Comment corrected by T. D. Noe, Mar 28 2008]
Numbers with more 4k+1 divisors than 4k+3 divisors. If a(n) is a member of this sequence, then so too is any power of a(n). - Ant King, Oct 05 2010
A000161(a(n)) > 0; A070176(a(n)) = 0. - Reinhard Zumkeller, Feb 04 2012, Aug 16 2011
Numbers that are the norms of Gaussian integers. This sequence has unique factorization; the primitive elements are A055025. - Franklin T. Adams-Watters, Nov 25 2011
These are numbers n such that all of n's odd prime factors congruent to 3 modulo 4 occur to an even exponent (Fermat's two-squares theorem). - Jean-Christophe Hervé, May 01 2013
Let's say that an integer n divides a lattice if there exists a sublattice of index n. Example: 2, 4, 5 divide the square lattice. The present sequence without 0 is the sequence of divisors of the square lattice. Say that n is a "prime divisor" if the index-n sublattice is not contained in any other sublattice except the original lattice itself. Then A055025 (norms of Gaussian primes) gives the "prime divisors" of the square lattice. - Jean-Christophe Hervé, May 01 2013
For any i,j > 0 a(i)*a(j) is a member of this sequence, since (a^2 + b^2)*(c^2 + d^2) = (a*c + b*d)^2 + (a*d - b*c)^2. - Boris Putievskiy, May 05 2013
The sequence is closed under multiplication. Primitive elements are in A055025. The sequence can be split into 3 multiplicatively closed subsequences: {0}, A004431 and A125853. - Jean-Christophe Hervé, Nov 17 2013
Generalizing Jasinski's comment, same as numbers whose odd powers are the sum of 2 squares, by Fermat's two-squares theorem. - Jonathan Sondow, Jan 24 2014
By the 4 squares theorem, every nonnegative integer can be expressed as the sum of two elements of this sequence. - Franklin T. Adams-Watters, Mar 28 2015
There are never more than 3 consecutive terms. Runs of 3 terms start at 0, 8, 16, 72, ... (A082982). - Ivan Neretin, Nov 09 2015
Conjecture: barring the 0+2, 0+4, 0+8, 0+16, ... sequence, the sum of 2 distinct terms in this sequence is never a power of 2. - J. Lowell, Jan 14 2022
All the areas of squares whose vertices have integer coordinates. - Neeme Vaino, Jun 14 2023
Numbers represented by the definite binary quadratic forms x^2 + 2nxy + (n^2+1)y^2 for any integer n. This sequence contains the even powers of any integer. An odd power of a number appears only if the number itself belongs to the sequence. The equation given in the comment by Boris Putievskiy 2013 is Brahmagupta's identity with n = 1. It proves that any set of numbers of the form a^2 + nb^2 is closed under multiplication. - Klaus Purath, Sep 06 2023

References

  • J. H. Conway and N. J. A. Sloane, "Sphere Packings, Lattices and Groups", Springer-Verlag, p. 106.
  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
  • L. Euler, (E388) Vollständige Anleitung zur Algebra, Zweiter Theil, reprinted in: Opera Omnia. Teubner, Leipzig, 1911, Series (1), Vol. 1, p. 417.
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, pp. 98-104.
  • G. H. Hardy, Ramanujan, pp. 60-63.
  • P. Moree and J. Cazaran, On a claim of Ramanujan in his first letter to Hardy, Expos. Math. 17 (1999), pp. 289-312.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Disjoint union of A000290 and A000415.
Complement of A022544.
A000404 gives another version. Subsequence of A091072, supersequence of A046711.
Column k=2 of A336820.

Programs

  • Haskell
    a001481 n = a001481_list !! (n-1)
    a001481_list = [x | x <- [0..], a000161 x > 0]
    -- Reinhard Zumkeller, Feb 14 2012, Aug 16 2011
    
  • Magma
    [n: n in [0..160] | NormEquation(1, n) eq true]; // Arkadiusz Wesolowski, May 11 2016
    
  • Maple
    readlib(issqr): for n from 0 to 160 do for k from 0 to floor(sqrt(n)) do if issqr(n-k^2) then printf(`%d,`,n); break fi: od: od:
  • Mathematica
    upTo = 160; With[{max = Ceiling[Sqrt[upTo]]}, Select[Union[Total /@ (Tuples[Range[0, max], {2}]^2)], # <= upTo &]]  (* Harvey P. Dale, Apr 22 2011 *)
    Select[Range[0, 160], SquaresR[2, #] != 0 &] (* Jean-François Alcover, Jan 04 2013 *)
  • PARI
    isA001481(n)=local(x,r);x=0;r=0;while(x<=sqrt(n) && r==0,if(issquare(n-x^2),r=1);x++);r \\ Michael B. Porter, Oct 31 2009
    
  • PARI
    is(n)=my(f=factor(n));for(i=1,#f[,1],if(f[i,2]%2 && f[i,1]%4==3, return(0))); 1 \\ Charles R Greathouse IV, Aug 24 2012
    
  • PARI
    B=bnfinit('z^2+1,1);
    is(n)=#bnfisintnorm(B,n) \\ Ralf Stephan, Oct 18 2013, edited by M. F. Hasler, Nov 21 2017
    
  • PARI
    list(lim)=my(v=List(),t); for(m=0,sqrtint(lim\=1), t=m^2; for(n=0, min(sqrtint(lim-t),m), listput(v,t+n^2))); Set(v) \\ Charles R Greathouse IV, Jan 05 2016
    
  • PARI
    is_A001481(n)=!for(i=2-bittest(n,0),#n=factor(n)~, bittest(n[1,i],1)&&bittest(n[2,i],0)&&return) \\ M. F. Hasler, Nov 20 2017
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A001481_gen(): # generator of terms
        return filter(lambda n:(lambda m:all(d & 3 != 3 or m[d] & 1 == 0 for d in m))(factorint(n)),count(0))
    A001481_list = list(islice(A001481_gen(),30)) # Chai Wah Wu, Jun 27 2022

Formula

n = square * 2^{0 or 1} * {product of distinct primes == 1 (mod 4)}.
The number of integers less than N that are sums of two squares is asymptotic to constant*N/sqrt(log(N)), hence lim_{n->infinity} a(n)/n = infinity.
Nonzero terms in expansion of Dirichlet series Product_p (1 - (Kronecker(m, p) + 1)*p^(-s) + Kronecker(m, p)*p^(-2s))^(-1) for m = -1.
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533. - Charles R Greathouse IV, Apr 16 2012
There are B(x) = x/sqrt(log x) * (K + B2/log x + O(1/log^2 x)) terms of this sequence up to x, where K = A064533 and B2 = A227158. - Charles R Greathouse IV, Nov 18 2022

Extensions

Deleted an incorrect comment. - N. J. A. Sloane, Oct 03 2023

A363762 Numbers k for which A363763(k) = -1.

Original entry on oeis.org

46, 55, 62, 71, 80, 86, 107, 130, 172, 187, 195, 208, 222, 247, 259, 263, 268, 272, 280, 297, 314, 330, 358, 363, 370, 372, 379, 394, 400, 405, 429, 449, 450, 462, 489, 500, 529, 534, 587, 629, 641, 646, 652, 667, 668, 672, 704, 715, 733, 736, 749, 769, 775, 776, 778, 785, 793, 799
Offset: 1

Views

Author

Hugo Pfoertner, Jun 20 2023

Keywords

Crossrefs

Numbers not occurring as terms of A077773.

Programs

  • Python
    from itertools import count, islice
    from sympy import factorint
    def A363762_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            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:
                    break
            else:
                yield n
    A363762_list = list(islice(A363762_gen(),20)) # Chai Wah Wu, Jun 22 2023

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

A277192 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 even.

Original entry on oeis.org

1, 1, 3, 3, 4, 6, 6, 8, 8, 9, 11, 10, 13, 12, 13, 16, 15, 16, 17, 19, 17, 22, 20, 21, 23, 24, 23, 25, 26, 26, 28, 30, 28, 30, 31, 31, 31, 34, 34, 35, 35, 37, 37, 40, 38, 41, 42, 40, 44, 43, 44, 45, 44, 46, 45, 50, 50, 49, 48, 54, 53, 52, 52, 57, 55, 56, 57, 58, 58, 60, 60, 58, 65, 61, 64, 66, 64, 65, 66, 68, 69, 68, 70, 69
Offset: 0

Views

Author

Antti Karttunen, Oct 04 2016

Keywords

Crossrefs

Programs

  • Scheme
    (define (A277192 n) (add (lambda (i) (- 1 (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} (1-A000035(A002828(i))).
For all n >= 0, A277191(n) + a(n) = 2n+1.
For n >= 1, a(n) = A077773(n) + A277194(n).

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).

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.

A364443 a(n) is the number of integers k of the form x^2 + x*y + y^2 (A003136) with n^2 < k < (n+1)^2.

Original entry on oeis.org

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

Views

Author

Hugo Pfoertner, Aug 05 2023

Keywords

Comments

a(n) is the number of circles centered at (0,0) that pass through grid points of the hexagonal lattice that intersect the interior of an interval n < x < n+1 on the x-axis.

Crossrefs

Programs

  • PARI
    is_a003136(n) = !n || #qfbsolve(Qfb(1, 1, 1), n, 3);
    for (k=0, 75, my (k1=k^2+1, k2=k^2+2*k, m=0); for (j=k1, k2, m+=is_a003136(j)); print1(m,", "))
    
  • Python
    from sympy import factorint
    def A364443(n): return sum(1 for k in range(n**2+1,(n+1)**2) if not any(e&1 for p, e in factorint(k).items() if p % 3 == 2)) # Chai Wah Wu, Aug 07 2023

A364730 a(n) is the number of occurrences of n in A364443.

Original entry on oeis.org

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

Views

Author

Hugo Pfoertner, Aug 06 2023

Keywords

Comments

Compared to A364443 this sequence is what A363522 is to A077773.

Crossrefs

A364731 a(n) is the index of the first occurrence of n in A364443, or -1 if n doesn't occur.

Original entry on oeis.org

0, 1, 3, 5, 6, 8, 10, 14, 13, 17, 20, 19, 25, 24, 29, -1, 31, 36, 38, 40, 39, 44, 46, -1, 51, 52, 61, 57, 62, 60, 67, 71, 70, 72, 76, 77, 79, 92, 94, 86, 90, 91, 95, 99, 105, -1, 108, 104, 118, 116, 114, 124, 122, -1, 123, 130, 135, 134, 141, 138, 140, 160, 148
Offset: 0

Views

Author

Hugo Pfoertner, Aug 06 2023

Keywords

Comments

Compared to A364443, this sequence is what A363763 is to A077773.

Crossrefs

A364732 a(n) is the index of the last occurrence of n in A364443, or -1 if n doesn't occur.

Original entry on oeis.org

0, 2, 4, 5, 9, 11, 12, 16, 15, 18, 23, 22, 25, 30, 34, -1, 37, 36, 38, 43, 45, 53, 50, -1, 56, 59, 63, 64, 68, 69, 75, 73, 78, 80, 88, 85, 87, 92, 94, 96, 101, 107, 102, 103, 113, -1, 119, 112, 118, 117, 128, 124, 137, -1, 136, 139, 146, 144, 151, 153, 147, 160
Offset: 0

Views

Author

Hugo Pfoertner, Aug 06 2023

Keywords

Comments

Compared to A364443, this sequence is what A364341 is to A077773.

Crossrefs

Showing 1-10 of 19 results. Next