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.

A362951 a(n) is the Hamming distance between the binary expansions of n and phi(n) where phi is the Euler totient function (A000010).

This page as a plain text file.
%I A362951 #47 Feb 20 2024 07:44:44
%S A362951 0,2,1,2,1,1,1,2,4,3,1,1,1,1,3,2,1,2,1,3,3,3,1,1,3,3,2,1,1,3,1,2,4,3,
%T A362951 5,2,1,3,6,3,1,3,1,3,4,3,1,1,4,3,3,3,1,2,5,1,4,3,1,3,1,1,4,2,4,4,1,3,
%U A362951 4,5,1,2,1,5,4,3,4,4,1,3,5,5,1,3,3,5,6
%N A362951 a(n) is the Hamming distance between the binary expansions of n and phi(n) where phi is the Euler totient function (A000010).
%C A362951 a(2^k) = 2 for k >= 1.
%C A362951 a(p) = 1 for each odd prime p because phi(p) = p-1 and (p-1 xor p) = 1.
%H A362951 Paolo Xausa, <a href="/A362951/b362951.txt">Table of n, a(n) for n = 1..10000</a>
%F A362951 a(n) = A101080(n,A000010(n)).
%F A362951 a(n) = A000120(A169814(n)).
%t A362951 A362951[n_] := DigitCount[BitXor[n, EulerPhi[n]], 2, 1];
%t A362951 Array[A362951, 100] (* _Paolo Xausa_, Feb 20 2024 *)
%o A362951 (Python)
%o A362951 from gmpy2 import mpz, hamdist
%o A362951 from sympy import totient
%o A362951 a = lambda n: hamdist(mpz(n), mpz(totient(n)))
%o A362951 print([a(n) for n in range(1, 87)])
%o A362951 (Python)
%o A362951 from sympy import totient
%o A362951 def A362951(n): return (n^totient(n)).bit_count() # _Chai Wah Wu_, Jul 07 2023
%Y A362951 Cf. A000010, A000120, A065091, A101080, A169814.
%K A362951 nonn,base,less
%O A362951 1,2
%A A362951 _DarĂ­o Clavijo_, Jul 05 2023