A387423 The length of binary expansion of n minus the length of the maximal common prefix of the binary expansions of n and sigma(n), where sigma is the sum of divisors function.
0, 1, 1, 2, 2, 0, 2, 3, 3, 2, 3, 2, 2, 2, 2, 4, 2, 1, 3, 1, 3, 3, 4, 3, 3, 4, 4, 0, 2, 4, 4, 5, 5, 5, 5, 4, 2, 5, 5, 3, 2, 5, 3, 3, 4, 4, 5, 4, 4, 5, 5, 3, 2, 4, 5, 3, 5, 5, 3, 5, 2, 4, 4, 6, 5, 4, 3, 6, 6, 4, 4, 6, 2, 6, 6, 4, 6, 5, 5, 4, 6, 6, 3, 6, 6, 5, 6, 2, 2, 6, 6, 4, 5, 5, 6, 5, 2, 6, 6, 4, 2, 4, 4, 1, 4
Offset: 1
Links
Crossrefs
Programs
-
Mathematica
A387423[n_] := BitLength[n] - LengthWhile[Transpose[IntegerDigits[{n, DivisorSigma[1, n]}, 2][[All, ;; BitLength[n]]]], Equal @@ # &]; Array[A387423, 100] (* Paolo Xausa, Sep 03 2025 *)
-
PARI
A387423(n) = { my(a=binary(n), b=binary(sigma(n)), i=1); while(i<=#a,if(a[i]!=b[i],return(#a-(i-1))); i++); (0); };
-
Python
from os.path import commonprefix from sympy import divisor_sigma def A387423(n): return n.bit_length()-len(commonprefix([bin(n)[2:],bin(divisor_sigma(n))[2:]])) # Chai Wah Wu, Sep 03 2025
Comments