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

A193174 Duplicate of A126084.

Original entry on oeis.org

0, 2, 1, 4, 3, 8, 5, 20, 7, 16, 13, 18, 55, 30, 53, 26, 47, 20, 41
Offset: 0

Views

Author

Keywords

A199398 XOR of the first n odd numbers.

Original entry on oeis.org

1, 2, 7, 0, 9, 2, 15, 0, 17, 2, 23, 0, 25, 2, 31, 0, 33, 2, 39, 0, 41, 2, 47, 0, 49, 2, 55, 0, 57, 2, 63, 0, 65, 2, 71, 0, 73, 2, 79, 0, 81, 2, 87, 0, 89, 2, 95, 0, 97, 2, 103, 0, 105, 2, 111, 0, 113, 2, 119, 0, 121, 2, 127, 0, 129, 2, 135, 0, 137, 2, 143, 0, 145, 2, 151, 0, 153, 2, 159, 0, 161, 2, 167, 0, 169, 2, 175, 0, 177, 2, 183, 0, 185, 2, 191
Offset: 1

Views

Author

Paul D. Hanna, Nov 05 2011

Keywords

Examples

			a(2) = 1 XOR 3 = 2; a(3) = 1 XOR 3 XOR 5 = 7; a(4) = 1 XOR 3 XOR 5 XOR 7 = 0.
		

Crossrefs

Cf. A126084 (XOR of first n primes).

Programs

  • Maple
    a := proc(n) local u,b,w,k;
    u := 1; w := 1; b := true;
    for k from 2 to n do
       u := u + 2;
       w := u + `if`(b, -w, +w);
       b := not b;
    od; w end:
    seq(a(n), n=1..95); # Peter Luschny, Dec 31 2014
  • Mathematica
    With[{c=Range[1,201,2]},Table[BitXor@@Take[c,n],{n,100}]] (* Harvey P. Dale, Nov 19 2011 *)
  • PARI
    a(n)=if(n==1,1,bitxor(a(n-1),2*n-1))
    
  • PARI
    Vec((1 + 2*x + 6*x^2 - 2*x^3 + x^4)/(1-x^2)/(1-x^4)+O(x^99)) \\ Charles R Greathouse IV, Dec 31 2014
    
  • Python
    from operator import xor
    from functools import reduce
    def A199398(n): return reduce(xor,range(1,n<<1,2)) # Chai Wah Wu, Jul 09 2022

Formula

G.f.: x*(1 + 2*x + 6*x^2 - 2*x^3 + x^4)/((1-x^2)*(1-x^4)).

A293927 Numbers n such that prime(k) XOR prime(k+1) XOR ... XOR prime(n) = 0 for some k < n (where XOR denotes the binary XOR operator, and prime(n) = A000040(n)).

Original entry on oeis.org

17, 28, 30, 33, 36, 43, 45, 47, 51, 52, 56, 58, 65, 66, 72, 74, 76, 80, 84, 90, 94, 107, 111, 119, 126, 129, 130, 133, 137, 143, 145, 155, 156, 166, 169, 174, 179, 185, 192, 200, 202, 204, 208, 213, 214, 216, 219, 228, 238, 246, 248, 249, 250, 254, 258, 262
Offset: 1

Views

Author

Rémy Sigrist, Oct 21 2017

Keywords

Comments

Equivalently, numbers n such that A126084(n) = A126084(m) for some m < n.
See A293983(n) for the least k such that prime(k) XOR prime(k+1) XOR ... XOR prime(a(n)) = 0.

Examples

			prime(33) XOR prime(34) XOR prime(35) XOR prime(36) = 137 XOR 139 XOR 149 XOR 151 = 0, hence 36 appears in the sequence.
		

Crossrefs

Programs

  • Maple
    N:= 1000: # to get all terms <= N
    R[0]:= 0: T:= 2: p:= 2;
    Res:= NULL:
    for n from 2 to N do
      p:= nextprime(p);
      T:= Bits:-Xor(T,p);
      if assigned(R[T]) then Res:= Res, n
      else R[T]:= n
      fi
    od:
    Res; # Robert Israel, Oct 22 2017
  • PARI
    s = 0; seen = 2^0; for (i = 1, 262, s = bitxor(s, prime(i)); if (bittest(seen, s), print1 (i ", "), seen += 2^s))

A293983 a(n) = least k > 0 such that prime(k) XOR prime(k+1) XOR ... XOR prime(A293927(n)) = 0 (where XOR denotes the binary XOR operator, and prime(n) = A000040(n)).

Original entry on oeis.org

8, 19, 15, 26, 33, 30, 26, 38, 22, 49, 47, 45, 58, 63, 69, 63, 65, 65, 71, 69, 69, 92, 92, 88, 123, 86, 123, 80, 132, 140, 80, 70, 153, 161, 56, 155, 176, 182, 145, 195, 143, 185, 133, 202, 125, 123, 216, 225, 235, 121, 237, 246, 235, 219, 227, 105, 260, 254
Offset: 1

Views

Author

Rémy Sigrist, Oct 21 2017

Keywords

Comments

If a(n) = 1, then A126084(A293927(n)) = 0.
For any n > 0, A293927(n) - a(n) + 1 >= 4 (we need to XOR at least 4 consecutive prime numbers in order to obtain 0).
For any n > 0, if a(n) > 1 then A293927(n) - a(n) + 1 is even (we need to XOR an even number of odd prime numbers in order to obtain 0).

Crossrefs

Programs

  • PARI
    prev = vector(1774); s = 0; pi = 0; n = 0; forprime (p=1, 1697, pi++; s = bitxor(s, p); if (s==0 || prev[s], n++; print1 (prev[s]+1 ", "), prev[s] = pi));
Showing 1-4 of 4 results.