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.

A057653 Odd numbers of form x^2 + y^2.

Original entry on oeis.org

1, 5, 9, 13, 17, 25, 29, 37, 41, 45, 49, 53, 61, 65, 73, 81, 85, 89, 97, 101, 109, 113, 117, 121, 125, 137, 145, 149, 153, 157, 169, 173, 181, 185, 193, 197, 205, 221, 225, 229, 233, 241, 245, 257, 261, 265, 269, 277, 281, 289, 293, 305, 313, 317, 325, 333, 337
Offset: 1

Views

Author

N. J. A. Sloane, Oct 15 2000

Keywords

Comments

Numbers with only odd prime factors and such that all prime factors congruent to 3 modulo 4 occur to an even exponent. - Jean-Christophe Hervé, Oct 24 2015
Odd terms of A020668. - Altug Alkan, Nov 19 2015
Also one half of the numbers that are the sum of two odd squares (without multiplicity). See A097269 for twice the numbers. - Wolfdieter Lang, Jan 12 2017

Crossrefs

Odd members of A001481.
Odd members of A020668.
Complement of A084109 in 4k+1 numbers (A016813).
Cf. A016754 (odd squares), A097269.

Programs

  • Maple
    readlib(issqr): for n from 1 to 1001 by 2 do for k from 0 to floor(sqrt(n)) do if issqr(n-k^2) then printf(`%d,`,n); break fi; od:od:
  • Mathematica
    fQ[n_] := Length@ Catch@ Do[If[IntegerQ@ Sqrt[n - k^2], Throw[{k, Sqrt[n - k^2]}], Nothing], {k, Floor[Sqrt@ n]^2}] != 0; Select[Range[1, 340, 2], fQ] (* Michael De Vlieger, Nov 13 2015 *)
  • PARI
    isok(n)=my(f=factor(n)); for(i=1, #f[, 1], if(f[i, 2]%2 && f[i, 1]%4==3, return(0))); 1;
    for(n=1, 1e3, if(isok(n) && n%2==1, print1(n", "))) \\ Altug Alkan, Nov 13 2015
    
  • PARI
    for(n=0, 1e3, if(if( n<1, n==0, 2 * qfrep([ 1, 0; 0, 4], n)[n]) != 0 && n%2==1, print1(n, ", "))) \\ Altug Alkan, Nov 19 2015
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A057653_gen(): # generator of terms
        return filter(lambda n:all(p & 3 != 3 or e & 1 == 0 for p, e in factorint(n).items()),count(1,2))
    A057653_list = list(islice(A057653_gen(),30)) # Chai Wah Wu, Jun 28 2022

Formula

n = odd square * {product of distinct primes == 1 (mod 4)}.
a(n) = A097269(n)/2. - Wolfdieter Lang, Jan 12 2017

Extensions

More terms from James Sellers, Oct 16 2000