login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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.
4
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, 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, 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
OFFSET
2,1
LINKS
MATHEMATICA
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 *)
PROG
(PARI) a(n) = {my(k = 1, hn = hammingweight(n)); while ((hammingweight(k) != hn) || (gcd(n, k) == 1), k++); k; } \\ Michel Marcus, Oct 27 2017
CROSSREFS
KEYWORD
base,nonn,look
AUTHOR
Leroy Quet, Oct 05 2008
EXTENSIONS
Extended by Ray Chandler, Nov 03 2008
STATUS
approved