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.

A224915 a(n) = Sum_{k=0..n} n XOR k where XOR is the bitwise logical exclusive-or operator.

This page as a plain text file.
%I A224915 #37 Aug 22 2023 08:01:42
%S A224915 0,1,5,6,22,23,27,28,92,93,97,98,114,115,119,120,376,377,381,382,398,
%T A224915 399,403,404,468,469,473,474,490,491,495,496,1520,1521,1525,1526,1542,
%U A224915 1543,1547,1548,1612,1613,1617,1618,1634,1635,1639,1640,1896,1897,1901,1902,1918
%N A224915 a(n) = Sum_{k=0..n} n XOR k where XOR is the bitwise logical exclusive-or operator.
%H A224915 Michael De Vlieger, <a href="/A224915/b224915.txt">Table of n, a(n) for n = 0..10000</a>
%F A224915 a(n) = Sum_{j=1..n} 4^(v_2(j)), where v_2(j) is the exponent of highest power of 2 dividing j. - _Ridouane Oudra_, Jun 08 2019
%F A224915 a(n) = n + 3*Sum_{j=1..floor(log_2(n))} 4^(j-1)*floor(n/2^j), for n>=1. - _Ridouane Oudra_, Dec 09 2020
%F A224915 From _Kevin Ryde_, Dec 17 2021: (Start)
%F A224915 a(2*n+b) = 4*a(n) + n + b where b = 0 or 1.
%F A224915 a(n) = (A001196(n) - n)/2.
%F A224915 a(n) = A350093(n) - A222423(n), being XOR = OR - AND.
%F A224915 (End)
%e A224915 a(2) = (0 xor 2) + (1 xor 2) = 2 + 3 = 5.
%p A224915 read("transforms"):
%p A224915 A051933 := proc(n,k)
%p A224915     XORnos(n,k) ;
%p A224915 end proc:
%p A224915 A224915 := proc(n)
%p A224915     add(A051933(n,k),k=0..n) ;
%p A224915 end proc: # _R. J. Mathar_, Apr 26 2013
%p A224915 # second Maple program:
%p A224915 with(MmaTranslator[Mma]):
%p A224915 seq(add(BitXor(n,i),i=0..n),n=0..60); # _Ridouane Oudra_, Dec 09 2020
%t A224915 Array[Sum[BitXor[#, k], {k, 0, #}] &, 53, 0] (* _Michael De Vlieger_, Dec 09 2020 *)
%o A224915 (Python)
%o A224915 for n in range(59):
%o A224915     s = 0
%o A224915     for k in range(n):  s += n ^ k
%o A224915     print(s, end=',')
%o A224915 (Python)
%o A224915 def A224915(n): return 3*int(bin(n)[2:],4)-n>>1 # _Chai Wah Wu_, Aug 21 2023
%o A224915 (PARI) a(n) = sum(k=0, n, bitxor(n, k)); \\ _Michel Marcus_, Jun 08 2019
%o A224915 (PARI) a(n) = (3*fromdigits(binary(n),4) - n) >>1; \\ _Kevin Ryde_, Dec 17 2021
%Y A224915 Cf. A001196 (bit doubling).
%Y A224915 Row sums of A051933.
%Y A224915 Other sums: A222423 (AND), A350093 (OR), A265736 (IMPL), A350094 (CNIMPL), A004125 (mod).
%K A224915 nonn,easy
%O A224915 0,3
%A A224915 _Alex Ratushnyak_, Apr 19 2013