login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Greatest common divisor of n and the binary representation of n interpreted decimally.
3

%I #16 Sep 12 2022 11:27:20

%S 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,

%T 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,

%U 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

%N Greatest common divisor of n and the binary representation of n interpreted decimally.

%H Antti Karttunen, <a href="/A076775/b076775.txt">Table of n, a(n) for n = 1..16384</a>

%H Antti Karttunen, <a href="/A076775/a076775.txt">Data supplement: n, a(n) computed for n = 1..65537</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%e 12 is '1100' in binary representation: a(12) = gcd(12,1100) = gcd(3*2^2,11*5^2*2^2) = 4.

%t Table[GCD[n,FromDigits[IntegerDigits[n,2]]],{n,100}] (* _Harvey P. Dale_, Jun 18 2014 *)

%o (PARI)

%o A007088(n) = fromdigits(binary(n), 10); \\ From A007088.

%o A076775(n) = gcd(n, A007088(n)); \\ _Antti Karttunen_, May 18 2019

%o (Python)

%o from math import gcd

%o def A076775(n): return gcd(n,int(bin(n)[2:])) # _Chai Wah Wu_, Sep 12 2022

%Y Cf. A007088.

%K nonn,base

%O 1,2

%A _Reinhard Zumkeller_, Nov 14 2002