|
|
A362951
|
|
a(n) is the Hamming distance between the binary expansions of n and phi(n) where phi is the Euler totient function (A000010).
|
|
1
|
|
|
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, 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, 4, 5, 1, 2, 1, 5, 4, 3, 4, 4, 1, 3, 5, 5, 1, 3, 3, 5, 6
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
a(2^k) = 2 for k >= 1.
a(p) = 1 for each odd prime p because phi(p) = p-1 and (p-1 xor p) = 1.
|
|
LINKS
|
|
|
FORMULA
|
|
|
MATHEMATICA
|
A362951[n_] := DigitCount[BitXor[n, EulerPhi[n]], 2, 1];
|
|
PROG
|
(Python)
from gmpy2 import mpz, hamdist
from sympy import totient
a = lambda n: hamdist(mpz(n), mpz(totient(n)))
print([a(n) for n in range(1, 87)])
(Python)
from sympy import totient
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base,less
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|