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

A145827 Numbers n such that A145768(n) is a square.

Original entry on oeis.org

0, 1, 7, 9, 14, 15, 16, 24, 33, 63, 89, 193, 240, 255, 271, 430, 448, 528, 575, 729, 742, 783, 903, 1297, 1776, 2409, 2623, 3494, 4079, 4159, 5439, 8278, 13631, 13737, 16128, 41825, 53007, 64344, 95985, 99015, 100607, 138238, 147734, 198976, 256177, 262079, 262335, 278847
Offset: 1

Views

Author

M. F. Hasler, Oct 20 2008

Keywords

Crossrefs

A145828 = A145768 intersect A000290 = { A145768(a(n)) }.

Programs

  • PARI
    an=0;for(i=1,10^5,an=bitxor(an,i^2);issquare(an)&print1(i","))
    
  • Python
    import math
    x = 0
    for i in range(1<<20):
        x ^= i*i
        t = int(math.sqrt(x))
        if x == t*t:
            print(str(i), end=', ')
    # Alex Ratushnyak, Mar 27 2013

Extensions

More terms from Alex Ratushnyak, Mar 27 2013

A145829 Square root of squares in A145768 (XOR of squares of the numbers 1..n).

Original entry on oeis.org

1, 4, 1, 15, 0, 16, 20, 31, 16, 49, 65, 224, 96, 96, 337, 144, 720, 400, 945, 625, 928, 828, 367, 928, 1889, 624, 2609, 3568, 3568, 2064, 10273, 1040, 545, 12384, 12639, 56800, 25812, 15119, 36, 864, 144383, 146463, 195440, 61391, 61072, 61072, 58128, 25872
Offset: 1

Views

Author

M. F. Hasler, Oct 20 2008

Keywords

Crossrefs

a(n) = A000196( A145828(n)) = A000196( A145768( A145827(n))); A145828 = { a(n)^2 } = A145768 intersect A000290.

Programs

  • Haskell
    a145829 n = a145829_list !! (n-1)
    a145829_list = map a000196 $ filter ((== 1) . a010052) $ tail a145768_list
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Mathematica
    an = 0; Reap[ For[i = 1, i <= 10^6, i++, an = BitXor[an, i^2]; If[IntegerQ[r = Sqrt[an]], Print[r]; Sow[r]]]][[2, 1]] (* Jean-François Alcover, Oct 11 2013, translated from Pari *)
  • PARI
    an=0; for( i=1,10^4, an=bitxor(an,i^2); issquare(an,&an) && print1(an","))
    
  • Python
    from itertools import count, islice
    from sympy import integer_nthroot
    def A145829gen(): # generator of terms
        m = 0
        for n in count(1):
            m ^= n**2
            a, b = integer_nthroot(m,2)
            if b: yield a
    A145829_list = list(islice(A145829gen(),20)) # Chai Wah Wu, Dec 16 2021

A145828 Squares in A145768 (XOR of squares of the numbers 1...n).

Original entry on oeis.org

0, 1, 16, 1, 225, 0, 256, 400, 961, 256, 2401, 4225, 50176, 9216, 9216, 113569, 20736, 518400, 160000, 893025, 390625, 861184, 685584, 134689, 861184, 3568321, 389376, 6806881, 12730624, 12730624, 4260096, 105534529
Offset: 1

Views

Author

M. F. Hasler, Oct 20 2008

Keywords

Crossrefs

Equals A145768 intersect A000290; a(n) = A145768(A145827(n)) = A145829(n)^2.

Programs

  • Mathematica
    Reap[For[Sow[x=0]; k=1, k <= 10^4, k++, x = BitXor[x, k^2]; If[IntegerQ[ Sqrt[x]], Sow[x]]]][[2, 1]] (* Jean-François Alcover, Nov 25 2015 *)
  • PARI
    an=0; for( i=1,10^4, an=bitxor(an,i^2); issquare(an) && print1(an","))
    
  • PARI
    {a(n) = my(x, m, k); while( mMichael Somos, Aug 05 2014 */
  • Python
    from gmpy2 import is_square
    filter(is_square, [reduce(lambda x,y:x^y, [x**2 for x in range(n)]) for n in range(1,10**4)]) # Chai Wah Wu, Aug 05 2014
    

Extensions

Edited to start at 0 to match A145768 by Chai Wah Wu, Aug 05 2014

A145830 Indices for which A145768 (XOR of squares of the numbers 1...n) is a power of 2.

Original entry on oeis.org

1, 7, 9, 16, 47, 63
Offset: 1

Views

Author

M. F. Hasler, Oct 20 2008

Keywords

Comments

Next term is > 10^7.
a(7) > 1.5*10^9. [Jon E. Schoenfield, Jan 14 2009]
a(7) > 10^11. [Sean A. Irvine, Aug 12 2010]

Crossrefs

A145830 = A145768 intersect A000079. A145768(a(n)) = 2^A145831(n); See also A145827-A145829.

Programs

  • Mathematica
    Position[ FoldList[ BitXor, 0, Range[10^6]^2], n_ /; IntegerQ[Log[2, n]]] - 1 // Flatten (* Jean-François Alcover, Sep 30 2013 *)
  • PARI
    an=0; for( i=1,10^6, an=bitxor(an,i^2); an & an==1<
    				

A145831 Log_2 ( A145768( A145830(n))).

Original entry on oeis.org

0, 4, 0, 8, 9, 8
Offset: 1

Views

Author

M. F. Hasler, Oct 20 2008

Keywords

Crossrefs

A145830 = A145768 intersect A000079. A145768(A145830(n)) = 2^a(n). See also A145827-A145829.

Programs

  • PARI
    an=0; for( i=1,10^7, an=bitxor(an,i^2); an & an==1<
    				

A014601 Numbers congruent to 0 or 3 mod 4.

Original entry on oeis.org

0, 3, 4, 7, 8, 11, 12, 15, 16, 19, 20, 23, 24, 27, 28, 31, 32, 35, 36, 39, 40, 43, 44, 47, 48, 51, 52, 55, 56, 59, 60, 63, 64, 67, 68, 71, 72, 75, 76, 79, 80, 83, 84, 87, 88, 91, 92, 95, 96, 99, 100, 103, 104, 107, 108, 111, 112, 115, 116, 119, 120, 123, 124
Offset: 0

Views

Author

Eric Rains (rains(AT)caltech.edu)

Keywords

Comments

Discriminants of orders in imaginary quadratic fields (negated). [Comment corrected by Christopher E. Thompson, Dec 11 2016]
Numbers such that Langford-Skolem problem has a solution - see A014552.
Complement of A042963. - Reinhard Zumkeller, Oct 04 2004
Also called skew amenable numbers; a number k is skew amenable if there exist a set {a(i)} of integers satisfying the relations k = Sum_{i=1..k} a(i) = -Product_{i=1..k} a(i). Thus we have 8 = 1 + 1 + 1 + 1 + 1 + 1 - 2 + 4 = -(1*1*1*1*1*1*(-2)*4). - Lekraj Beedassy, Jan 07 2005
Possible nonpositive discriminants of quadratic equation a*x^2 + b*x + c or discriminants of binary quadratic forms a*x^2 + b*x*y + c*y^2. - Artur Jasinski, Apr 28 2008
Also, disregarding the 0 term, positive integers m such that, equivalently,
(i) +-1 +-2 +-... +-m is even for all choices of signs,
(ii) +-1 +-2 +-... +-m = 0 for some choices of signs,
(iii) for all -m <= k <= m, k = +-1 +-2 +-... +-(k-1) +-(k+1) +-(k+2) +-... +-m for at least one choice of signs. - Rick L. Shepherd, Oct 29 2008
A145768(a(n)) is even. - Reinhard Zumkeller, Jun 05 2012
Multiples of 4 interleaved with 1 less than multiples of 4. - Wesley Ivan Hurt, Nov 08 2013
((2*k+0) + (2*k+1) + ... + (2*k+m-1) + (2*k+m)) is even if and only if m = a(n) for some n where k is any nonnegative integer. - Gionata Neri, Jul 24 2015
Numbers whose binary reflected Gray code (A014550) ends with 0. - Amiram Eldar, May 17 2021

Examples

			G.f. = 3*x + 4*x^2 + 7*x^3 + 8*x^4 + 11*x^5 + 12*x^6 + 15*x^7 + 16*x^8 + ...
		

References

  • H. Cohen, Course in Computational Alg. No. Theory, Springer, 1993, pp. 514-5.
  • A. Scholz and B. Schoeneberg, Einführung in die Zahlentheorie, 5. Aufl., de Gruyter, Berlin, New York, 1973, p. 108.

Crossrefs

Cf. A274406. - Bruno Berselli, Jun 26 2016

Programs

  • Haskell
    a014601 n = a014601_list !! n
    a014601_list = [x | x <- [0..], mod x 4 `elem` [0, 3]]
    -- Reinhard Zumkeller, Jun 05 2012
  • Magma
    [n: n in [0..200]|n mod 4 in {0,3}]; // Vincenzo Librandi, Dec 24 2010
    
  • Maple
    A014601:=n->3*n-2*floor(n/2); seq(A014601(k), k=0..100); # Wesley Ivan Hurt, Nov 08 2013
  • Mathematica
    aa = {}; Do[Do[Do[d = b^2 - 4 a c; If[d <= 0, AppendTo[aa, -d]], {a, 0, 50}], {b, 0, 50}], {c, 0, 50}]; Union[aa] (* Artur Jasinski, Apr 28 2008 *)
    Select[Range[0, 124], Or[Mod[#, 4] == 0, Mod[#, 4] == 3] &] (* Ant King, Nov 18 2010 *)
    CoefficientList[Series[2 x/(1 - x)^2 + (1/(1 - x) + 1/(1 + x)) x/2, {x, 0, 100}], x] (* Vincenzo Librandi, May 18 2014 *)
    a[ n_] := 2 n + Mod[n, 2]; (* Michael Somos, Jul 24 2015 *)
  • PARI
    {a(n) = 2*n + n%2}; /* Michael Somos, Dec 27 2010 */
    

Formula

a(n) = (n + 1)*2 + 1 - n mod 2. - Reinhard Zumkeller, Apr 21 2003
A014494(n) = A000217(a(n)). - Reinhard Zumkeller, Oct 04 2004
a(n) = Sum_{k=1..n} (2 - (-1)^k). - William A. Tedeschi, Mar 20 2008
A139131(a(n)) = A078636(a(n)). - Reinhard Zumkeller, Apr 10 2008
From R. J. Mathar, Sep 25 2009: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3) for n > 2.
G.f.: x*(3+x)/((1+x)*(x-1)^2). (End)
a(n) = 2*n + (n mod 2). - Paolo Valzasina (p.valzasina(AT)gmail.com), Nov 24 2009
a(n) = (4*n - (-1)^n + 1)/2. - Bruno Berselli, Oct 06 2010
a(n) = 4*n - a(n-1) - 1 (with a(0) = 0). - Vincenzo Librandi, Dec 24 2010
a(n) = -A042948(-n) for all n in Z. - Michael Somos, Dec 27 2010
G.f.: 2*x / (1 - x)^2 + (1 / (1 - x) + 1 / (1 + x)) * x/2. - Michael Somos, Dec 27 2010
a(n) = Sum_{k>=0} A030308(n,k)*b(k) with b(0) = 3 and b(k) = 2^(k+1) for k > 0. - Philippe Deléham, Oct 17 2011
a(n) = ceiling((4/3)*ceiling(3*n/2)). - Clark Kimberling, Jul 04 2012
a(n) = 3n - 2*floor(n/2). - Wesley Ivan Hurt, Nov 08 2013
a(n) = A042948(n+1) - 1 for all n in Z. - Michael Somos, Jul 24 2015
a(n) + a(n+1) = A004767(n) for all n in Z. - Michael Somos, Jul 24 2015
Sum_{n>=1} (-1)^(n+1)/a(n) = 3*log(2)/4 - Pi/8. - Amiram Eldar, Dec 05 2021
E.g.f.: ((4*x + 1)*exp(x) - exp(-x))/2. - David Lovler, Aug 04 2022

A042963 Numbers congruent to 1 or 2 mod 4.

Original entry on oeis.org

1, 2, 5, 6, 9, 10, 13, 14, 17, 18, 21, 22, 25, 26, 29, 30, 33, 34, 37, 38, 41, 42, 45, 46, 49, 50, 53, 54, 57, 58, 61, 62, 65, 66, 69, 70, 73, 74, 77, 78, 81, 82, 85, 86, 89, 90, 93, 94, 97, 98, 101, 102, 105, 106, 109, 110, 113, 114, 117, 118, 121, 122, 125, 126, 129, 130, 133, 134, 137, 138
Offset: 1

Views

Author

Keywords

Comments

Complement of A014601. - Reinhard Zumkeller, Oct 04 2004
Let S(x) = (1, 2, 2, 2, ...). Then A042963 = ((S(x))^2 + S(x^2))/2 = ((1, 4, 8, 12, 16, 20, ...) + (1, 0, 2, 0, 2, 0, 2, ...))/2 = (1, 2, 5, 6, 9, 10, ...). - Gary W. Adamson, Jan 03 2011
(a(n)*(a(n) + 1 + 4*k))/2 is odd, for k >= 0. - Gionata Neri, Jul 19 2015
Equivalent to the following variation on Fermat's Diophantine m-tuple: 1 + the product of any two distinct terms is not a square; this sequence, which we'll call sequence S, is produced by the following algorithm. At the start, S is initially empty. At stage n, starting at n = 1, the algorithm checks whether there exists a number m already in the sequence, such that mn+1 is a perfect square. If such a number m is found, then n is not added to the sequence; otherwise, n is added. Then n is incremented to n + 1, and we repeat the procedure. Proof by Clark R. Lyons: We prove by strong induction that n is in the sequence S if and only if n == 1 (mod 4) or n == 2 (mod 4). Suppose now that this holds for all k < n. In case 1, either n == 1 (mod 4) or n == 2 (mod 4), and we wish to show that n does indeed enter the sequence S. That is, we wish to show that there does not exist m < n, already in the sequence at this point such that mn+1 is a square. By the inductive hypothesis m == 1 (mod 4) or m == 2 (mod 4). This means that both m and n are one of 1, 2, 5, or 6 mod 8. Using a multiplication table mod 8, we see that this implies mn+1 is congruent to one of 2, 3, 5, 6, or 7 mod 8. But we also see that mod 8, a perfect square is congruent to 0, 1, or 4. Thus mn+1 is not a perfect square, so n is added to the sequence. In case 2, n == 0 (mod 4) or n == 3 (mod 4), and we wish to show that n is not added to the sequence. That is, we wish to show that there exists m < n already in the sequence such that mn+1 is a perfect square. For this we let m = n - 2, which is positive since n >= 3. By the inductive hypothesis, since m == 1 (mod 4) or m == 2 (mod 4) and m < n, m is already in the sequence. And we have m*n + 1 = (n - 2)*n + 1 = n^2 - 2*n + 1 = (n - 1)^2, so mn+1 is indeed a perfect square, and so n is not added to the sequence. Thus n is added to the sequence if and only if n == 1 (mod 4) or n == 2 (mod 4). This completes the proof. - Robert C. Lyons, Jun 30 2016
Also the number of maximal cliques in the (n + 1) X (n + 1) black bishop graph. - Eric W. Weisstein, Dec 01 2017
Lexicographically earliest sequence of distinct positive integers such that the average of any two or more consecutive terms is never an integer. (For opposite property see A005408.) - Ivan Neretin, Dec 21 2017
Numbers whose binary reflected Gray code (A014550) ends with 1. - Amiram Eldar, May 17 2021
Also: append its negated last bit to n-1. - M. F. Hasler, Oct 17 2022

Crossrefs

Cf. A153284 (first differences), A014848 (partial sums).
Cf. A014550, A046712 (subsequence).
Union of A016813 and A016825.

Programs

  • Haskell
    a042963 n = a042963_list !! (n-1)
    a042963_list = [x | x <- [0..], mod x 4 `elem` [1,2]]
    -- Reinhard Zumkeller, Feb 14 2012
  • Magma
    [ n : n in [1..165] | n mod 4 eq 1 or n mod 4 eq 2 ]; // Vincenzo Librandi, Jan 25 2011
    
  • Maple
    A046923:=n->(n mod 2) + 2n - 2; seq(A046923(n), n=1..100); # Wesley Ivan Hurt, Oct 10 2013
  • Mathematica
    Select[Range[109], Or[Mod[#, 4] == 1, Mod[#, 4] == 2] &] (* Ant King, Nov 17 2010 *)
    Table[(4 n - 3 - (-1)^n)/2, {n, 20}] (* Eric W. Weisstein, Dec 01 2017 *)
    LinearRecurrence[{1, 1, -1}, {1, 2, 5}, 20] (* Eric W. Weisstein, Dec 01 2017 *)
    CoefficientList[Series[(1 + x + 2 x^2)/((-1 + x)^2 (1 + x)), {x, 0, 20}], x] (* Eric W. Weisstein, Dec 01 2017 *)
  • PARI
    a(n)=2*n-1-(n-1)%2 \\ Jianing Song, Oct 06 2018; adapted to offset by Michel Marcus, Sep 09 2022
    
  • PARI
    apply( A042963(n)=n*2-2+n%2, [1..99]) \\ M. F. Hasler, Oct 17 2022
    

Formula

a(n) = 1 + A042948(n-1). [Corrected by Jianing Song, Oct 06 2018]
From Michael Somos, Jan 12 2000: (Start)
G.f.: x*(1 + x + 2*x^2)/((1 - x)^2*(1 + x)).
a(n) = a(n-1) + 2 + (-1)^n, a(0) = 1. (End) [This uses offset 0. - Jianing Song, Oct 06 2018]
A014493(n) = A000217(a(n)). - Reinhard Zumkeller, Oct 04 2004, Feb 14 2012
a(n) = Sum_{k=0..n} (A001045(k) mod 4). - Paul Barry, Mar 12 2004
A145768(a(n)) is odd. - Reinhard Zumkeller, Jun 05 2012
a(n) = A005843(n-1) + A059841(n-1). - Philippe Deléham, Mar 31 2009 [Corrected by Jianing Song, Oct 06 2018]
a(n) = 4*n - a(n-1) - 5 for n > 1. [Corrected by Jerzy R Borysowicz, Jun 09 2023]
From Ant King, Nov 17 2010: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3).
a(n) = (4*n - 3 - (-1)^n)/2. (End)
a(n) = (n mod 2) + 2*n - 2. - Wesley Ivan Hurt, Oct 10 2013
A163575(a(n)) = n - 1. - Reinhard Zumkeller, Jul 22 2014
E.g.f.: 2 + (2*x - 1)*sinh(x) + 2*(x - 1)*cosh(x). - Ilya Gutkovskiy, Jun 30 2016
E.g.f.: 2 + (2*x - 1)*exp(x) - cosh(x). - David Lovler, Jul 19 2022
Sum_{n>=1} (-1)^(n+1)/a(n) = Pi/8 + log(2)/4. - Amiram Eldar, Dec 05 2021

Extensions

Offset corrected by Reinhard Zumkeller, Feb 14 2012
More terms by David Lovler, Jul 19 2022

A003815 a(0) = 0, a(n) = a(n-1) XOR n.

Original entry on oeis.org

0, 1, 3, 0, 4, 1, 7, 0, 8, 1, 11, 0, 12, 1, 15, 0, 16, 1, 19, 0, 20, 1, 23, 0, 24, 1, 27, 0, 28, 1, 31, 0, 32, 1, 35, 0, 36, 1, 39, 0, 40, 1, 43, 0, 44, 1, 47, 0, 48, 1, 51, 0, 52, 1, 55, 0, 56, 1, 59, 0, 60, 1, 63, 0, 64, 1, 67, 0
Offset: 0

Views

Author

Keywords

Crossrefs

Cf. A003816.
Cf. A077140, A145768. - M. F. Hasler, Oct 20 2008

Programs

  • Mathematica
    an = 0; Reap[ For[i = 0, i <= 100, i++, an = BitXor[an, i]; Sow[an]]][[2, 1]] (* Jean-François Alcover, Oct 11 2013, translated from PARI *)
    CoefficientList[Series[x (1 + 3 x - x^2 + x^3)/((1 - x^4) (1 - x^2)), {x, 0, 100}], x] (* Vincenzo Librandi, Oct 12 2013 *)
    nxt[{n_,a_}]:={n+1,BitXor[n+1,a]}; NestList[nxt,{0,0},70][[All,2]] (* Harvey P. Dale, Mar 10 2019 *)
    {#,1,#+1,0}[[1+Mod[#,4]]]&/@Range[0,100] (* Federico Provvedi, May 10 2021 *)
  • PARI
    print1(an=0); for( i=1,100, print1(",",an=bitxor(an,i))) \\ M. F. Hasler, Oct 20 2008

Formula

a(n) = n + (-1)^n*a(n-1). - Vladeta Jovovic, Mar 13 2003
a(0)=0, a(4n+1)=1, a(4n+2)=4n+3, a(4n+3)=0, a(4n+4)=4n+4, n >= 0.
a(n) = f(n,0) with f(n,x) = x if n=0, otherwise f(n-1,x+n) if x is even, otherwise f(n-1,x-n). - Reinhard Zumkeller, Oct 09 2007
a(n) = abs(A077140(n)) for n > 0. - Reinhard Zumkeller, Oct 09 2007
G.f.: x*(1+3*x-x^2+x^3)/((1-x^4)*(1-x^2)). - Vincenzo Librandi, Oct 12 2013
a(n) = (1 + n + n*(-1)^n + (-1)^floor((n-1)/2))/2. - Wesley Ivan Hurt, May 08 2021

A193232 Bitwise XOR of first n triangular numbers.

Original entry on oeis.org

0, 1, 2, 4, 14, 1, 20, 8, 44, 1, 54, 116, 58, 97, 8, 112, 248, 97, 202, 116, 166, 65, 188, 424, 132, 449, 158, 484, 114, 449, 16, 480, 1008, 449, 914, 484, 894, 449, 804, 40, 796, 65, 966, 116, 938, 1953, 920, 2032, 872, 1953, 858, 1652, 790, 1665, 844, 1352
Offset: 0

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0,
          Bits[Xor](a(n-1), n*(n+1)/2))
        end:
    seq(a(n), n=0..55);  # Alois P. Heinz, Feb 19 2023
  • Mathematica
    Module[{nn=60,trs},trs=Accumulate[Range[nn]];Table[BitXor@@Take[trs,n],{n,0,nn}]] (* Harvey P. Dale, Dec 15 2017 *)
  • PARI
    al(n) = local(m); vector(n,k,m=bitxor(m,k*(k+1)\2))
    
  • Python
    from operator import xor
    from functools import reduce
    def A193232(n): return reduce(xor, (x*(x+1) for x in range(n+1)))//2 # Chai Wah Wu, Dec 16 2021
Showing 1-9 of 9 results.