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-8 of 8 results.

A004431 Numbers that are the sum of 2 distinct nonzero squares.

Original entry on oeis.org

5, 10, 13, 17, 20, 25, 26, 29, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 73, 74, 80, 82, 85, 89, 90, 97, 100, 101, 104, 106, 109, 113, 116, 117, 122, 125, 130, 136, 137, 145, 146, 148, 149, 153, 157, 160, 164, 169, 170, 173, 178, 180, 181, 185, 193, 194, 197
Offset: 1

Views

Author

Keywords

Comments

Numbers whose prime factorization includes at least one prime congruent to 1 mod 4 and any prime factor congruent to 3 mod 4 has even multiplicity. - Franklin T. Adams-Watters, May 03 2006
Reordering of A055096 by increasing values and without repetition. - Paul Curtz, Sep 08 2008
A063725(a(n)) > 1. - Reinhard Zumkeller, Aug 16 2011
The square of these numbers is also the sum of two nonzero squares, so this sequence is a subsequence of A009003. - Jean-Christophe Hervé, Nov 10 2013
Closed under multiplication. Primitive elements are those with exactly one prime factor congruent to 1 mod 4 with multiplicity one (A230779). - Jean-Christophe Hervé, Nov 10 2013
From Bob Selcoe, Mar 23 2016: (Start)
Numbers c such that there is d < c, d >= 1 where c + d and c - d are square. For example, 53 + 28 = 81, 53 - 28 = 25.
Given a prime p == 1 mod 4, a term appears if and only if it is of the form p^i, p*2^j or p*k^2 {i,j,k >= 1}, or a product of any combination of these forms. Therefore, the products of any terms to any powers also are terms. For example, p(1) = 5 and p(2) = 13 so term 45 appears because 5*3^2 = 45 and term 416 appears because 13*2^5 = 416; therefore 45 * 416 = 18720 appears, as does 45^3 * 416^11 = 18720^3 * 416^8.
Numbers of the form j^2 + 2*j*k + 2*k^2 {j,k >= 1}. (End)
Suppose we have a term t = x^2 + y^2. Then s^2*t = (s*x)^2 + (s*y)^2 is a term for any s > 0. Also 2*t = (y+x)^2 + (x-y)^2 is a term. It follows that q*s^2*t is a term for any s > 0 and q=1 or 2. Examples: 2*7^2*26 = 28^2 + 42^2; 6^2*17 = 6^2 + 24^2. - Jerzy R Borysowicz, Aug 11 2017
To find terms up to some upper bound u, we can search for x^2 + y^2 = t where x is odd and y is even. Then we add all numbers of the form 2^m * t <= u and then remove duplicates. - David A. Corneth, Oct 04 2017
From Bernard Schott, Apr 13 2022: (Start)
The 5th comment "Closed under multiplication" can be proved with Brahmagupta's identity: (a^2+b^2) * (c^2+d^2) = (ac + bd)^2 + (ad - bc)^2.
The subsequence of primes is A002144. (End)

Examples

			53 = 7^2 + 2^2, so 53 is in the sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.List (findIndices)
    a004431 n = a004431_list !! (n-1)
    a004431_list = findIndices (> 1) a063725_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Maple
    isA004431 := proc(n)
        local a,b ;
        for a from 2 do
            if a^2>= n then
                return false;
            end if;
            b := n -a^2 ;
            if b < 1 then
                return false ;
            end if;
            if issqr(b) then
                if ( sqrt(b) <> a ) then
                    return true;
                end if;
            end if;
        end do:
        return false;
    end proc:
    A004431 := proc(n)
        option remember ;
        local a;
        if n = 1 then
            5;
        else
            for a from procname(n-1)+1 do
                if isA004431(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc: # R. J. Mathar, Jan 29 2013
  • Mathematica
    A004431 = {}; Do[a = 2 m * n; b = m^2 - n^2; c = m^2 + n^2; AppendTo[A004431, c], {m, 100}, {n, m - 1}]; Take[Union@A004431, 63] (* Robert G. Wilson v, May 02 2009 *)
    Select[Range@ 200, Length[PowersRepresentations[#, 2, 2] /. {{0, } -> Nothing, {a, b_} /; a == b -> Nothing}] > 0 &] (* Michael De Vlieger, Mar 24 2016 *)
  • PARI
    select( isA004431(n)={n>1 && vecmin((n=factor(n)%4)[,1])==1 && ![f[1]>2 && f[2]%2 | f<-n~]}, [1..199]) \\ M. F. Hasler, Feb 06 2009, updated Nov 24 2019
    
  • PARI
    is(n)=if(n<5, return(0)); my(f=factor(n)%4); if(vecmin(f[, 1])>1, return(0)); for(i=1, #f[, 1], if(f[i, 1]==3 && f[i, 2]%2, return(0))); 1
    for(n=1, 1e3, if(is(n), print1(n, ", "))) \\ Altug Alkan, Dec 06 2015
    
  • PARI
    upto(n) = {my(res = List(), s); forstep(i=1, sqrtint(n), 2, forstep(j = 2, sqrtint(n - i^2), 2, listput(res, i^2 + j^2))); s = #res; for(i = 1, s, t = res[i]; for(e = 1, logint(n \ res[i], 2), listput(res, t<<=1))); listsort(res, 1); res} \\ David A. Corneth, Oct 04 2017
    
  • Python
    def aupto(limit):
      s = [i*i for i in range(1, int(limit**.5)+2) if i*i < limit]
      s2 = set(a+b for i, a in enumerate(s) for b in s[i+1:] if a+b <= limit)
      return sorted(s2)
    print(aupto(197)) # Michael S. Branicky, May 10 2021

A063725 Number of ordered pairs (x,y) of positive integers such that x^2 + y^2 = n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Aug 23 2001

Keywords

Comments

a(A018825(n))=0; a(A000404(n))>0; a(A081324(n))=1; a(A004431(n))>1. - Reinhard Zumkeller, Aug 16 2011

Examples

			a(5) = 2 from the solutions (1,2) and (2,1).
		

Crossrefs

Cf. A000404 (the numbers n that can be represented in this form).
Column k=2 of A337165.

Programs

  • Haskell
    a063725 n =
       sum $ map (a010052 . (n -)) $ takeWhile (< n) $ tail a000290_list
    a063725_list = map a063725 [0..]
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Mathematica
    nn = 100; t = Table[0, {nn}]; s = Sqrt[nn]; Do[n = x^2 + y^2; If[n <= nn, t[[n]]++], {x, s}, {y, s}]; Join[{0}, t] (* T. D. Noe, Apr 03 2011 *)
  • PARI
    a(n)=if(n==0, return(0)); my(f=factor(n)); prod(i=1, #f~, if(f[i, 1]%4==1, f[i, 2]+1, f[i, 2]%2==0 || f[i, 1]==2)) - issquare(n) \\ Charles R Greathouse IV, May 18 2016
    
  • Python
    from math import prod
    from sympy import factorint
    def A063725(n):
        f = factorint(n)
        return prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items())-(not any(e&1 for e in f.values())) if n else 0 # Chai Wah Wu, May 17 2023

Formula

G.f.: (Sum_{m=1..inf} x^(m^2))^2.
a(n) = ( A004018(n) - 2*A000122(n) + A000007(n) )/4. - Max Alekseyev, Sep 29 2012
G.f.: (theta_3(q) - 1)^2/4, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Aug 08 2018

A025284 Numbers that are the sum of 2 nonzero squares in exactly 1 way.

Original entry on oeis.org

2, 5, 8, 10, 13, 17, 18, 20, 25, 26, 29, 32, 34, 37, 40, 41, 45, 52, 53, 58, 61, 68, 72, 73, 74, 80, 82, 89, 90, 97, 98, 100, 101, 104, 106, 109, 113, 116, 117, 122, 128, 136, 137, 146, 148, 149, 153, 157, 160, 162, 164, 169, 173, 178, 180, 181, 193, 194, 197, 202, 208, 212
Offset: 1

Views

Author

Keywords

Comments

A025426(a(n)) = 1. - Reinhard Zumkeller, Aug 16 2011

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a025284 n = a025284_list !! (n-1)
    a025284_list = elemIndices 1 a025426_list
    -- Reinhard Zumkeller, Aug 16 2011
  • Mathematica
    selQ[n_] := Length[ Select[ PowersRepresentations[n, 2, 2], Times @@ # != 0 &]] == 1; Select[Range[300], selQ] (* Jean-François Alcover, Oct 03 2013 *)
    b[n_, i_, k_, t_] := b[n, i, k, t] = If[n == 0, If[t == 0, 1, 0], If[i<1 || t<1, 0, b[n, i - 1, k, t] + If[i^2 > n, 0, b[n - i^2, i, k, t - 1]]]];
    T[n_, k_] := b[n, Sqrt[n] // Floor, k, k];
    Position[Table[T[n, 2], {n, 0, 300}], 1] - 1 // Flatten (* Jean-François Alcover, Nov 06 2020, after Alois P. Heinz in A243148 *)

Formula

A243148(a(n),2) = 1. - Alois P. Heinz, Feb 25 2019

A018825 Numbers that are not the sum of 2 nonzero squares.

Original entry on oeis.org

1, 3, 4, 6, 7, 9, 11, 12, 14, 15, 16, 19, 21, 22, 23, 24, 27, 28, 30, 31, 33, 35, 36, 38, 39, 42, 43, 44, 46, 47, 48, 49, 51, 54, 55, 56, 57, 59, 60, 62, 63, 64, 66, 67, 69, 70, 71, 75, 76, 77, 78, 79, 81, 83, 84, 86, 87, 88, 91, 92, 93, 94, 95, 96, 99, 102, 103, 105, 107, 108, 110
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A022544, A081324, A000404 (complement), A004431.

Programs

  • Haskell
    import Data.List (elemIndices)
    a018825 n = a018825_list !! (n-1)
    a018825_list = tail $ elemIndices 0 a025426_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Maple
    isA000404 := proc(n)
        local x,y ;
        for x from 1 do
            if x^2> n then
                return false;
            end if;
            for y from 1 do
                if x^2+y^2 > n then
                    break;
                elif x^2+y^2 = n then
                    return true;
                end if;
            end do:
        end do:
    end proc:
    A018825 := proc(n)
        if n = 1 then
            1;
        else
            for a from procname(n-1)+1 do
                if not isA000404(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A018825(n),n=1..30) ; # R. J. Mathar, Jul 28 2014
  • Mathematica
    q=13;q2=q^2+1;lst={};Do[Do[z=a^2+b^2;If[z<=q2,AppendTo[lst,z]],{b,a,1,-1}],{a,q}];lst; u=Union@lst;Complement[Range[q^2],u] (* Vladimir Joseph Stephan Orlovsky, May 30 2010 *)
  • PARI
    is(n)=my(f=factor(n), t=prod(i=1,#f~, if(f[i,1]%4==1, f[i,2]+1, if(f[i,2]%2 && f[i,1]>2, 0, 1)))); if(t!=1, return(!t)); for(k=sqrtint((n-1)\2)+1, sqrtint(n-1), if(issquare(n-k^2), return(0))); 1 \\ Charles R Greathouse IV, Sep 02 2015

Formula

A025426(a(n)) = 0; A063725(a(n)) = 0. - Reinhard Zumkeller, Aug 16 2011

A125022 Numbers with a unique partition as the sum of 2 squares x^2 + y^2.

Original entry on oeis.org

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

Views

Author

Artur Jasinski, Nov 16 2006

Keywords

Comments

A000161(a(n)) = 1. [Reinhard Zumkeller, Aug 16 2011]

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndices)
    a125022 n = a125022_list !! (n-1)
    a125022_list = elemIndices 1 a000161_list
    -- Reinhard Zumkeller, Aug 16 2011
  • Mathematica
    Select[Range[0,200],Length@PowersRepresentations[#,2,2]==1&] (* Giorgos Kalogeropoulos, Mar 21 2021 *)

Formula

a(n) = A125021(n)/2.

Extensions

Name edited by Giorgos Kalogeropoulos, Mar 21 2021

A286327 Least possible sum of the squares of the two initial terms of a Fibonacci-like sequence containing n.

Original entry on oeis.org

0, 1, 1, 1, 4, 1, 4, 5, 1, 9, 4, 5, 13, 1, 10, 9, 4, 17, 5, 13, 16, 1, 20, 10, 9, 25, 4, 25, 17, 5, 34, 13, 16, 26, 1, 41, 20, 10, 37, 9, 25, 29, 4, 50, 25, 17, 40, 5, 36, 34, 13, 53, 16, 26, 45, 1, 49, 41, 20, 58, 10, 37, 52, 9, 64, 25, 29, 65, 4, 50, 61, 25
Offset: 0

Views

Author

Rémy Sigrist, May 07 2017

Keywords

Comments

A Fibonacci-like sequence f satisfies f(n+2) = f(n+1) + f(n), and is uniquely identified by its two initial terms f(0) and f(1); here we consider Fibonacci-like sequences with f(0) >= 0 and f(1) >= 0.
This sequence is part of a family of variations of A249783, where we minimize a function g of the initial terms of Fibonacci-like sequences containing n:
- A249783: g(f) = f(0) + f(1),
- A286321: g(f) = f(0) * f(1),
- A286326: g(f) = max(f(0), f(1)),
- a: g(f) = f(0)^2 + f(1)^2.
For any n>0, a(n) <= n^2 (as the Fibonacci-like sequence with initial terms n and 0 contains n).
For any n>0, a(A000045(n)) = 1.
All terms belong to A001481 (numbers that are the sum of 2 squares).
No term > 0 belongs to A081324 (twice a square but not the sum of 2 distinct squares).

Examples

			See illustration of the first terms in Links section.
		

Crossrefs

Programs

  • Mathematica
    {0}~Join~Table[Module[{a = 0, b = 1, s = {}}, While[a <= n, AppendTo[s, Flatten@ NestWhileList[{#2, #1 + #2} & @@ # &, {a, b}, Last@ # < n &]]; If[a + b >= n, a++; b = 1, b++]]; Min@ Map[Total[(#[[1 ;; 2]])^2] &, Select[s, MemberQ[#, n] &]]], {n, 71}] (* Michael De Vlieger, May 10 2017 *)

A050804 Numbers n such that n^3 is the sum of two nonzero squares in exactly one way.

Original entry on oeis.org

2, 8, 18, 32, 72, 98, 128, 162, 242, 288, 392, 512, 648, 722, 882, 968, 1058, 1152, 1458, 1568, 1922, 2048, 2178, 2592, 2888, 3528, 3698, 3872, 4232, 4418, 4608, 4802, 5832, 6272, 6498, 6962, 7688, 7938, 8192
Offset: 1

Views

Author

Patrick De Geest, Sep 15 1999

Keywords

Comments

m is a term if and only if m = 2^(2a_0+1)*p_1^(2a_1)*p_2^(2a_2)*...*p_k^(2a_k), where a_i are nonnegative integers and p_i are primes of the form 4k+3. - Chai Wah Wu, Feb 27 2016
m is a term if and only if for all odd q > 1, m^q is the sum of two nonzero squares in exactly one way. - Chai Wah Wu, Feb 28 2016
Numbers n such that n is the sum of two nonzero squares while n^2 is not. - Altug Alkan, Apr 11 2016

Examples

			E.g. 32^3 = 128^2 + 128^2. Is there an example using different squares?
No: If n^3 has only one representation as n^3 = a^2+b^2 with 0<a<=b, then a=b. - _Jonathan Vos Post_, Feb 02 2011
		

Crossrefs

Programs

  • Haskell
    a050804 n = a050804_list !! (n-1)
    a050804_list = filter ((== 1) . a084888) [0..]
    -- Reinhard Zumkeller, Jul 18 2012
    
  • Mathematica
    ok[n_] := Length @ Cases[ PowersRepresentations[n^3, 2, 2], {?Positive, ?Positive}] == 1; Select[Range[8200], ok] (* Jean-François Alcover, Apr 05 2011 *)
  • Python
    from sympy import factorint
    A050804_list = [2*i for i in range(1,10**6) if not any(p % 4 == 1 or factorint(i)[p] % 2 for p in factorint(i))] # Chai Wah Wu, Feb 27 2016

Formula

n such that A084888(n) = 1.

Extensions

More terms from Michel ten Voorde and Jud McCranie

A272701 Taxi-cab numbers (A001235) that are the sum of two nonzero squares in more than one way.

Original entry on oeis.org

4624776, 15438250, 27445392, 36998208, 123506000, 127396178, 216226981, 219563136, 238328064, 269442621, 295985664, 310289733, 406767816, 423432360, 449519625, 510200217, 578097000, 590421637, 632767581, 634207392, 715674609, 751462677
Offset: 1

Views

Author

Altug Alkan, May 12 2016

Keywords

Comments

Motivation was that question: What are the numbers that are the sums of 2 positive cubes in more than 1 way and also sums of 2 positive squares in more than 1 way?
A001235(99) = 4624776 = 2^3*3^6*13*61 is the least number with this property.
A taxi-cab number (A001235) can be the sum of two nonzero squares in exactly one way. For example 22754277 is the least taxi-cab number that is the sum of two nonzero squares in exactly one way. 22754277 = 69^3 + 282^3 = 189^3 + 252^3 = 2646^2 + 3969^2. So 22754277 is not a member of this sequence. The next one is 8*22754277 = 182034216 = 138^3 + 564^3 = 378^3 + 504^3 = 2646^2 + 13230^2.
A taxi-cab number (A001235) can be of the form 2*n^2. For example 760032072 is the least number with this property. 760032072 = 114^3 + 912^3 = 513^3 + 855^3 = 2*19494^2. Note that 760032072 is a term of A081324. So it is not a term of this sequence.
216226981 = 373*661*877 is the first term that has three prime divisors. It is also first squarefree term in this sequence.
It is easy to see that this sequence is infinite.

Examples

			4624776 = 51^3 + 165^3 = 72^3 + 162^3 = 1026^2 + 1890^2 = 1350^2 + 1674^2.
27445392 = 141^3 + 291^3 = 198^3 + 270^3 = 756^2 + 5184^2 = 1296^2 + 5076^2.
36998208 = 102^3 + 330^3 = 144^3 + 324^3 = 648^2 + 6048^2 = 1728^2 + 5832^2.
		

Crossrefs

Programs

  • PARI
    T = thueinit(x^3+1, 1);
    isA001235(n) = {my(v=thue(T, n)); sum(i=1, #v, v[i][1]>=0 && v[i][2]>=v[i][1])>1;}
    isA007692(n) = {nb = 0; lim = sqrtint(n); for (x=1, lim, if ((n-x^2 >= x^2) && issquare(n-x^2), nb++);); nb >= 2;}
    isok(n) = isA001235(n) && isA007692(n);
Showing 1-8 of 8 results.