# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a145254 Showing 1-1 of 1 %I A145254 #13 Oct 27 2017 20:52:08 %S A145254 2,3,2,5,3,7,2,3,5,11,3,13,7,15,2,17,3,19,5,7,11,23,3,25,13,15,7,29, %T A145254 15,31,2,3,6,7,3,37,14,15,5,41,7,43,11,15,23,47,3,7,14,15,13,53,15,55, %U A145254 7,15,29,59,15,61,31,63,2,5,3,67,6,21,7,71,3,73,14,15,14,77,15,79,5,21,14,83 %N A145254 a(n) = the smallest positive integer that is non-coprime to n and has the same number of 1's in its binary representation as n. %H A145254 Michael De Vlieger, Table of n, a(n) for n = 2..16384 %t A145254 Table[Function[k, SelectFirst[Range[2, n], And[! CoprimeQ[#, n], DigitCount[#, 2, 1] == k] &]]@ DigitCount[n, 2, 1], {n, 2, 83}] (* _Michael De Vlieger_, Oct 26 2017 *) %o A145254 (PARI) a(n) = {my(k = 1, hn = hammingweight(n)); while ((hammingweight(k) != hn) || (gcd(n, k) == 1), k++); k;} \\ _Michel Marcus_, Oct 27 2017 %Y A145254 Cf. A145255, A145256, A145257. %K A145254 base,nonn,look %O A145254 2,1 %A A145254 _Leroy Quet_, Oct 05 2008 %E A145254 Extended by _Ray Chandler_, Nov 03 2008 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE