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

A283987 a(n) = A002487(n-1) XOR A002487(n), where XOR is bitwise-xor (A003987).

Original entry on oeis.org

1, 0, 3, 3, 2, 1, 1, 2, 5, 7, 6, 7, 7, 6, 7, 5, 4, 1, 3, 4, 11, 13, 2, 5, 5, 2, 13, 11, 4, 3, 1, 4, 7, 3, 12, 13, 15, 12, 13, 9, 8, 3, 5, 8, 9, 11, 14, 11, 11, 14, 11, 9, 8, 5, 3, 8, 9, 13, 12, 15, 13, 12, 3, 7, 6, 1, 13, 14, 11, 7, 4, 9, 11, 4, 25, 21, 22, 27, 7, 14, 13, 5, 24, 27, 29, 24, 31, 23, 20, 29, 31, 20, 23, 25, 2, 9, 9, 2, 25, 23, 20, 31, 29, 20, 23
Offset: 1

Views

Author

Antti Karttunen, Mar 21 2017

Keywords

Crossrefs

Odd bisection of A283977.
Cf. A283973 (positions where coincides with A007306, or equally, with A283986).

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[BitXor[a[n - 1], a@ n], {n, 120}] (* Michael De Vlieger, Mar 22 2017 *)
  • PARI
    A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
    for(n=1, 120, print1(bitxor(A(n - 1), A(n)), ", ")) \\ Indranil Ghosh, Mar 23 2017
    
  • Python
    from functools import reduce
    def A283987(n): return sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0)))^sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n-1)[-1:2:-1],(1,0))) if n>1 else 1 # Chai Wah Wu, May 05 2023
  • Scheme
    (define (A283987 n) (A003987bi (A002487 (- n 1)) (A002487 n))) ;; Where A003987bi implements bitwise-XOR (A003987).
    

Formula

a(n) = A002487(n-1) XOR A002487(n), where XOR is bitwise-xor (A003987).
a(n) = A283986(n) - A283988(n).
a(n) = A007306(n) - 2*A283988(n).
a(n) = A283977((2*n)-1).

A283976 a(2n) = A002487(n), a(2n+1) = A002487(n) OR A002487(n+1), where OR is bitwise-or (A003986).

Original entry on oeis.org

0, 1, 1, 1, 1, 3, 2, 3, 1, 3, 3, 3, 2, 3, 3, 3, 1, 5, 4, 7, 3, 7, 5, 7, 2, 7, 5, 7, 3, 7, 4, 5, 1, 5, 5, 5, 4, 7, 7, 7, 3, 11, 8, 13, 5, 7, 7, 7, 2, 7, 7, 7, 5, 13, 8, 11, 3, 7, 7, 7, 4, 5, 5, 5, 1, 7, 6, 7, 5, 13, 9, 13, 4, 15, 11, 15, 7, 15, 10, 11, 3, 11, 11, 11, 8, 13, 13, 13, 5, 13, 12, 15, 7, 15, 9, 11, 2, 11, 9, 15, 7, 15, 12, 13, 5, 13, 13, 13, 8
Offset: 0

Views

Author

Antti Karttunen, Mar 21 2017

Keywords

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[If[EvenQ@ n, a[n/2], BitOr[a[#], a[# + 1]] &[(n - 1)/2]], {n, 0, 108}] (* Michael De Vlieger, Mar 22 2017 *)
  • PARI
    A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
    a(n) = if(n<2, n, if(n%2, bitor(A(n\2), A((n + 1)/2)), A(n\2)));
    for(n=0, 101, print1(a(n),", ")) \\ Indranil Ghosh, Mar 23 2017
  • Scheme
    (define (A283976 n) (if (even? n) (A002487 n) (A003986bi (A002487 (/ (- n 1) 2)) (A002487 (/ (+ n 1) 2))))) ;; Where A003986bi implements bitwise-OR (A003986).
    

Formula

a(2n) = A002487(2n) = A002487(n), a(2n+1) = A002487(n) OR A002487(n+1), where OR is bitwise-or (A003986).
a(n) = A283977(n) + A283978(n).
a(n) = A002487(n) - A283978(n).

A283978 a(2n) = 0, a(2n+1) = A002487(n) AND A002487(n+1), where AND is bitwise-and (A004198).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Mar 21 2017

Keywords

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := If[EvenQ@ n, a[n/2], a[(n - 1)/2] + a[(n + 1)/2]]; Table[If[EvenQ@ n, 0, BitAnd[a[#], a[# + 1]] &[(n - 1)/2]], {n, 0, 120}] (* Michael De Vlieger, Mar 22 2017 *)
  • PARI
    A(n) = if(n<2, n, if(n%2, A(n\2) + A((n + 1)/2), A(n/2)));
    a(n) = if(n<2, 0, if(n%2, bitand(A(n\2), A((n + 1)/2)), 0));
    for(n=0, 120, print1(a(n), ", ")) \\ Indranil Ghosh, Mar 23 2017
  • Scheme
    (define (A283978 n) (if (even? n) 0 (A004198bi (A002487 (/ (- n 1) 2)) (A002487 (/ (+ n 1) 2))))) ;; Where A004198bi implements bitwise-AND (A004198).
    

Formula

a(2n) = 0, a(2n+1) = A002487(n) AND A002487(n+1), where AND is bitwise-and (A004198).
a(n) = A283976(n) - A283977(n).
a(n) = A002487(n) - A283976(n) = (A002487(n) - A283977(n))/2.
Showing 1-3 of 3 results.