login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I

%S 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 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 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 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 Michael De Vlieger, <a href="/A145254/b145254.txt">Table of n, a(n) for n = 2..16384</a>

%t 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 (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 Cf. A145255, A145256, A145257.

%K base,nonn,look

%O 2,1

%A _Leroy Quet_, Oct 05 2008

%E Extended by _Ray Chandler_, Nov 03 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified October 20 17:24 EDT 2018. Contains 316392 sequences. (Running on oeis4.)