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.
%I A177718 #17 Jan 18 2022 15:59:21 %S A177718 0,2,1,3,2,2,1,1,3,3,5,0,0,2,4,2,4,4,1,1,1,3,1,1,1,1,3,3,3,1,7,2,2,0, %T A177718 0,2,2,0,2,2,2,2,6,2,0,2,2,6,2,2,2,6,2,6,5,1,1,1,1,1,1,1,1,3,1,3,1,1, %U A177718 3,3,1,3,5,3,5,7,1,1,1,1,1,1,5,1,5,5,1,1,3,5,3,7,5,5,5,7,7,4,2,0,2,0,0,0,2 %N A177718 a(n) = |(number of 1's in binary representation of prime(n)) - (number of 0's in binary representation of prime(n))|. %H A177718 Karl-Heinz Hofmann, <a href="/A177718/b177718.txt">Table of n, a(n) for n = 1..10000</a> %F A177718 a(n) = abs(A014499(n) - A035103(n)). %F A177718 a(n) = abs(A037861(prime(n))). - _R. J. Mathar_, May 15 2010 %e A177718 a(1)=0 because 2 = 10_2 and abs(1-1) = 0; %e A177718 a(2)=2 because 3 = 11_2 and abs(0-2) = 2; %e A177718 a(3)=1 because 5 = 101_2 and abs(1-2) = 1. %p A177718 A023416 := proc(n) a := 0 ; for d in convert(n,base,2) do if d = 0 then a := a+1 ; end if; end do; a ; end proc: %p A177718 A000120 := proc(n) a := 0 ; for d in convert(n,base,2) do if d = 1 then a := a+1 ; end if; end do; a ; end proc: %p A177718 A037861 := proc(n) A023416(n)-A000120(n) ; end proc: %p A177718 A177718 := proc(n) abs(A037861(ithprime(n))) ; end proc: seq(A177718(n),n=1..120) ; # _R. J. Mathar_, May 15 2010 %p A177718 # second Maple program: %p A177718 a:= n-> abs(add(2*i-1, i=Bits[Split](ithprime(n)))): %p A177718 seq(a(n), n=1..105); # _Alois P. Heinz_, Jan 18 2022 %t A177718 nzmnu[n_]:=Module[{z=DigitCount[n,2,0]},Abs[2z-IntegerLength[n,2]]]; nzmnu/@ Prime[Range[110]] (* _Harvey P. Dale_, Feb 15 2015 *) %o A177718 (Python) from sympy import isprime %o A177718 print([abs(bin(n)[2:].count("1") - bin(n)[2:].count("0")) for n in range (0,1000) if isprime(n)]) # _Karl-Heinz Hofmann_, Jan 18 2022 %Y A177718 Cf. A000040, A000120, A004676. %K A177718 nonn,base %O A177718 1,2 %A A177718 _Juri-Stepan Gerasimov_, May 12 2010, May 18 2010 %E A177718 Corrected at three or more places by _R. J. Mathar_, May 15 2010