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.

A232243 a(n) = wt(n^2) - wt(n), where wt(n) = A000120(n) is the binary weight function.

This page as a plain text file.
%I A232243 #18 Mar 05 2023 01:57:32
%S A232243 0,0,0,0,0,1,0,0,0,1,1,2,0,1,0,0,0,1,1,2,1,3,2,-1,0,2,1,2,0,1,0,0,0,1,
%T A232243 1,2,1,3,2,3,1,2,3,3,2,4,-1,-1,0,2,2,1,1,4,2,2,0,2,1,2,0,1,0,0,0,1,1,
%U A232243 2,1,3,2,3,1,3,3,5,2,3,3,0,1,3,2,4,3,3,3,2,2,5,4,0,-1,1,-1,-1,0,2,2,2
%N A232243 a(n) = wt(n^2) - wt(n), where wt(n) = A000120(n) is the binary weight function.
%C A232243 A077436 lists n for which a(n) = 0.
%C A232243 A094694 lists n for which a(n) < 0.
%H A232243 Dumitru Damian, <a href="/A232243/b232243.txt">Table of n, a(n) for n = 0..10000</a>
%F A232243 a(n) = A159918(n) - A000120(n).
%e A232243 a(5): 5 = 101_2, 25 = 11001_2, so a(5) = 3 - 2 = 1.
%e A232243 a(23): 23 = 10111_2, 529 = 10001001_2, so a(23) = 3 - 4 = -1.
%o A232243 (JavaScript)
%o A232243 function bitCount(n) {
%o A232243    var i,c,s;
%o A232243    c=0;
%o A232243    s=n.toString(2);
%o A232243    for (i=0;i<s.length;i++)
%o A232243       if (s.charAt(i)==1)
%o A232243          c++;
%o A232243    return c;
%o A232243 }
%o A232243 for (i=0;i<100;i++) document.write(bitCount(i*i)-bitCount(i)+", ");
%o A232243 (Python)
%o A232243 def A232243(n): return (n**2).bit_count()-n.bit_count()
%o A232243 print(list(A232243(n) for n in range(10**2)))  # _Dumitru Damian_, Mar 04 2023
%o A232243 (PARI) a(n) = hammingweight(n^2) - hammingweight(n); \\ _Michel Marcus_, Mar 05 2023
%Y A232243 Cf. A000120, A159918, A077436, A094694, A231898.
%K A232243 sign,base
%O A232243 0,12
%A A232243 _Jon Perry_, Nov 20 2013