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 10 results.

A002479 Numbers of the form x^2 + 2*y^2.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 8, 9, 11, 12, 16, 17, 18, 19, 22, 24, 25, 27, 32, 33, 34, 36, 38, 41, 43, 44, 48, 49, 50, 51, 54, 57, 59, 64, 66, 67, 68, 72, 73, 75, 76, 81, 82, 83, 86, 88, 89, 96, 97, 98, 99, 100, 102, 107, 108, 113, 114, 118, 121, 123, 128, 129, 131
Offset: 1

Views

Author

Keywords

Comments

A positive number k belongs to this sequence if and only if every prime p == 5, 7 (mod 8) dividing k occurs to an even power. - Sharon Sela (sharonsela(AT)hotmail.com), Mar 23 2002
Norms of numbers in Z[sqrt(-2)]. - Alonso del Arte, Sep 23 2014
Euler (E256) shows that these numbers are closed under multiplication, according to the Euler Archive. - Charles R Greathouse IV, Jun 16 2016
In addition to the previous comment: The proof was already given 1100 years before Euler by Brahmagupta's identity (a^2 + m*b^2)*(c^2 + m*d^2) = (a*c - m*b*d)^2 + m*(a*d + b*c)^2. - Klaus Purath, Oct 07 2023

References

  • L. Euler, (E388) Vollstaendige Anleitung zur Algebra, Zweiter Theil, reprinted in: Opera Omnia. Teubner, Leipzig, 1911, Series (1), Vol. 1, p. 421.
  • D. H. Lehmer, Guide to Tables in the Theory of Numbers. Bulletin No. 105, National Research Council, Washington, DC, 1941, p. 59.
  • 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

Complement of A097700. Subsequence of A000408. For primes see A033203.

Programs

  • Haskell
    a002479 n = a002479_list !! (n-1)
    a002479_list = 0 : filter f [1..] where
       f x = all (even . snd) $ filter ((`elem` [5,7]) . (`mod` 8) . fst) $
                                zip (a027748_row x) (a124010_row x)
    -- Reinhard Zumkeller, Feb 20 2014
    
  • Magma
    [n: n in [0..131] | NormEquation(2, n) eq true]; // Arkadiusz Wesolowski, May 11 2016
    
  • Maple
    lis:={}; M:=50; M2:=M^2;
    for x from 0 to M do for y from 0 to M do
    if x^2+2*y^2 <= M2 then lis:={op(lis),x^2+2*y^2}; fi; od: od:
    sort(convert(lis,list)); # N. J. A. Sloane, Apr 30 2015
  • Mathematica
    q = 16; imax = q^2; Select[Union[Flatten[Table[x^2 + 2y^2, {y, 0, q/Sqrt[2]}, {x, 0, q}]]], # <= imax &] (* Vladimir Joseph Stephan Orlovsky, Apr 20 2011 *)
    Union[#[[1]]+2#[[2]]&/@Tuples[Range[0,10]^2,2]] (* Harvey P. Dale, Nov 24 2014 *)
  • PARI
    is(n)=my(f=factor(n));for(i=1,#f[,1],if(f[i,1]%8>4 && f[i,2]%2, return(0)));1 \\ Charles R Greathouse IV, Nov 20 2012
    
  • PARI
    list(lim)=my(v=List()); for(a=0,sqrtint(lim\=1), for(b=0,sqrtint((lim-a^2)\2), listput(v,a^2+2*b^2))); Set(v) \\ Charles R Greathouse IV, Jun 16 2016
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A002479_gen(): # generator of terms
        return filter(lambda n:all(p & 7 < 5 or e & 1 == 0 for p, e in factorint(n).items()),count(0))
    A002479_list = list(islice(A002479_gen(),30)) # Chai Wah Wu, Jun 27 2022

A001394 Number of n-step self-avoiding walks on diamond.

Original entry on oeis.org

1, 4, 12, 36, 108, 324, 948, 2796, 8196, 24060, 70188, 205284, 597996, 1744548, 5073900, 14774652, 42922452, 124814484, 362267652, 1052271732, 3051900516, 8857050204, 25671988020, 74449697484, 215677847460, 625096195404, 1810062340812, 5243388472212
Offset: 0

Views

Author

Keywords

Comments

Number of 2 X n binary matrices avoiding simultaneously the right-angled numbered polyomino patterns (ranpp) (00;1) and (01;1). An occurrence of a ranpp (xy;z) in a matrix A=(a(i,j)) is a triple (a(i1,j1), a(i1,j2), a(i2,j1)) where i1 < i2, j1 < j2 and these elements are in same relative order as those in the triple (x,y,z). - Sergey Kitaev, Nov 11 2004

References

  • 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

Extensions

Edited and extended by Joseph Myers, Jul 21 2013
a(24)-a(27) from Sean A. Irvine, Nov 13 2017

A216282 Number of nonnegative solutions to the equation x^2 + 2*y^2 = n.

Original entry on oeis.org

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

Views

Author

V. Raman, Sep 03 2012

Keywords

Comments

Records occur at 1, 9, 81, 297, 891, 1683, 5049, 15147, 31977, ... - Antti Karttunen, Aug 23 2017

Examples

			For n = 9, there are two solutions: 9 = 9^2 + 2*(0^2) = 1^2 + 2*(2^2), thus a(9) = 2.
For n = 81, there are three solutions: 81 = 9^2 + 2*(0^2) = 3^2 + 2*(6^2) = 7^2 + 2*(4^2), thus a(81) = 3.
For n = 65536, there is one solution: 65536 = 256^2 + 2*(0^2) = 65536 + 0, thus a(65536) = 1.
For n = 65537, there is one solution: 65537 = 255^2 + 2*(16^2) = 65205 + 512, thus a(65537) = 1.
		

Crossrefs

Cf. A002479 (positions of nonzeros), A097700 (of zeros).

Programs

  • Mathematica
    r[n_] := Reduce[x >= 0 && y >= 0 && x^2 + 2 y^2 == n, Integers];
    a[n_] := Which[rn = r[n]; rn === False, 0, Head[rn] === And, 1, Head[rn] === Or, Length[rn], True, -1];
    Table[a[n], {n, 1, 120}] (* Jean-François Alcover, Jun 24 2017 *)
  • Scheme
    (define (A216282 n) (cond ((< n 2) 1) (else (let loop ((k (- (A000196 n) (modulo (- n (A000196 n)) 2))) (s 0)) (if (< k 0) s (let ((x (/ (- n (* k k)) 2))) (loop (- k 2) (+ s (A010052 x))))))))) ;; Antti Karttunen, Aug 23 2017

Extensions

Examples from Antti Karttunen, Aug 23 2017

A034030 Imprimitively represented by x^2+2y^2.

Original entry on oeis.org

0, 4, 8, 9, 12, 16, 18, 24, 25, 27, 32, 36, 44, 48, 49, 50, 54, 64, 68, 72, 75, 76, 81, 88, 96, 98, 99, 100, 108, 121, 128, 132, 136, 144, 147, 150, 152, 153, 162, 164, 169, 171, 172, 176, 192, 196, 198, 200, 204, 216, 225, 228
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    # Maple code for A002479, A057127, A034030-A034034 from N. J. A. Sloane, Apr 30 2015
    lis:={}; lisP:={}; lisI:={};
    M:=50; M2:=M^2;
    for x from 0 to M do
       x2:=x^2;
    for y from 0 to M do
       N:=x2+2*y^2;
    if N <= M2 then
       if gcd(x,y) = 1 then lisP:={op(lisP),N}; else lisI:={op(lisI),N} fi;
       lis:={op(lis),N};
    fi;
    od: od:
    lprint("lis");
    Lis:=sort(convert(lis,list));
    lprint("lisP");
    LisP:=sort(convert(lisP,list));
    lprint("lisI");
    LisI:=sort(convert(lisI,list));
    lprint("lisPnotI");
    LisPnotI:=sort(convert(lisP minus lisI, list));
    lprint("lisInotP");
    LisInotP:=sort(convert(lisI minus lisP,list));
    lprint("lisIandP");
    LisIandP:=sort(convert(lisI intersect lisP,list));
    lprint("liseither");
    Liseither:=sort(convert(lis minus (lisI intersect lisP),list));

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015

A034034 Numbers that are primitively or imprimitively represented by x^2+2y^2, but not both.

Original entry on oeis.org

0, 1, 2, 3, 4, 6, 8, 11, 12, 16, 17, 19, 22, 24, 25, 32, 33, 34, 36, 38, 41, 43, 44, 48, 49, 50, 51, 57, 59, 64, 66, 67, 68, 72, 73, 75, 76, 82, 83, 86, 88, 89, 96, 97, 98, 100, 102, 107, 108, 113, 114, 118, 123, 128, 129, 131
Offset: 1

Views

Author

Keywords

Crossrefs

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015

A034031 Numbers that are primitively but not imprimitively represented by x^2+2y^2.

Original entry on oeis.org

1, 2, 3, 6, 11, 17, 19, 22, 33, 34, 38, 41, 43, 51, 57, 59, 66, 67, 73, 82, 83, 86, 89, 97, 102, 107, 113, 114, 118, 123, 129, 131, 134, 137, 139, 146, 163, 166, 177, 178, 179, 187, 193, 194, 201, 209, 211, 214, 219, 226, 227
Offset: 1

Views

Author

Keywords

Crossrefs

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015

A034033 Both primitively and imprimitively represented by x^2+2y^2.

Original entry on oeis.org

9, 18, 27, 54, 81, 99, 121, 153, 162, 171, 198, 242, 243, 289, 297, 306, 342, 361, 363, 369, 387, 459, 486, 513, 531, 578, 594, 603, 657, 722, 726, 729, 738, 747, 774, 801, 867, 873, 891, 918, 963, 1017, 1026, 1062, 1083, 1089
Offset: 1

Views

Author

Keywords

Crossrefs

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015

A055052 Numbers of the form 4^i*(8j+7) or 4^i*(8j+5).

Original entry on oeis.org

5, 7, 13, 15, 20, 21, 23, 28, 29, 31, 37, 39, 45, 47, 52, 53, 55, 60, 61, 63, 69, 71, 77, 79, 80, 84, 85, 87, 92, 93, 95, 101, 103, 109, 111, 112, 116, 117, 119, 124, 125, 127, 133, 135, 141, 143, 148, 149, 151, 156, 157, 159, 165, 167, 173, 175
Offset: 1

Views

Author

N. J. A. Sloane, Jun 02 2000

Keywords

Comments

Numbers not of the form x^2+2y^2+8z^2.
The integers that are ratios between the terms constitute the sequence's complement within A003159. - Peter Munn, Feb 07 2024
The asymptotic density of this sequence is 1/3. - Amiram Eldar, Feb 09 2024

Crossrefs

Disjoint union of A004215 and A055045.
Subsequence of A003159, A097700.

Programs

  • Mathematica
    Select[Range[200], MemberQ[{5, 7}, Mod[# / 4^IntegerExponent[#, 4], 8]] &] (* Amiram Eldar, Feb 09 2024 *)
  • Python
    def A055052(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c = n+x
            for i in range(x.bit_length()>>1):
                m = x>>(i<<1)
                c -= (m-5>>3)+(m-7>>3)+2
            return c
        return bisection(f,n,n) # Chai Wah Wu, Feb 14 2025

A034028 Numbers n not of form (x^2+2y^2 with x >= y >= 0).

Original entry on oeis.org

2, 5, 7, 8, 10, 13, 14, 15, 19, 20, 21, 22, 23, 26, 28, 29, 30, 31, 32, 35, 37, 39, 40, 41, 42, 45, 46, 47, 50, 52, 53, 55, 56, 58, 59, 60, 61, 62, 63, 65, 69, 70, 71, 73, 74, 76, 77, 78, 79, 80, 84, 85, 87, 88, 90, 91, 92, 93, 94, 95, 97, 98, 101, 103, 104, 105
Offset: 1

Views

Author

Keywords

Crossrefs

Complement of A034027. Cf. A097700.

Extensions

Definition corrected by N. J. A. Sloane, Apr 30 2015

A034032 Imprimitively but not primitively represented by x^2+2y^2.

Original entry on oeis.org

0, 4, 8, 12, 16, 24, 25, 32, 36, 44, 48, 49, 50, 64, 68, 72, 75, 76, 88, 96, 98, 100, 108, 128, 132, 136, 144, 147, 150, 152, 164, 169, 172, 176, 192, 196, 200, 204, 216, 225, 228, 236, 256, 264, 268, 272, 275, 288, 292, 294
Offset: 1

Views

Author

Keywords

Crossrefs

Extensions

Corrected by N. J. A. Sloane, Apr 30 2015
Showing 1-10 of 10 results.