A076775 Greatest common divisor of n and the binary representation of n interpreted decimally.
1, 2, 1, 4, 1, 2, 1, 8, 1, 10, 1, 4, 1, 2, 1, 16, 1, 2, 1, 20, 21, 2, 1, 8, 1, 2, 1, 4, 1, 10, 1, 32, 11, 2, 1, 4, 1, 2, 1, 40, 1, 42, 1, 4, 1, 2, 1, 16, 1, 10, 1, 4, 1, 2, 1, 8, 1, 2, 1, 20, 1, 2, 21, 64, 1, 22, 1, 4, 3, 10, 1, 8, 1, 2, 1, 4, 1, 2, 1, 80, 3, 2, 1, 84, 1, 2, 1, 8, 1, 10, 1
Offset: 1
Examples
12 is '1100' in binary representation: a(12) = gcd(12,1100) = gcd(3*2^2,11*5^2*2^2) = 4.
Links
- Antti Karttunen, Table of n, a(n) for n = 1..16384
- Antti Karttunen, Data supplement: n, a(n) computed for n = 1..65537
- Index entries for sequences related to binary expansion of n
Crossrefs
Cf. A007088.
Programs
-
Mathematica
Table[GCD[n,FromDigits[IntegerDigits[n,2]]],{n,100}] (* Harvey P. Dale, Jun 18 2014 *)
-
PARI
A007088(n) = fromdigits(binary(n), 10); \\ From A007088. A076775(n) = gcd(n, A007088(n)); \\ Antti Karttunen, May 18 2019
-
Python
from math import gcd def A076775(n): return gcd(n,int(bin(n)[2:])) # Chai Wah Wu, Sep 12 2022