login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A145256 a(n) = the smallest integer > n that is non-coprime to n and has the same number of 1's in its binary representation as n has. 5

%I #11 Feb 06 2020 01:04:08

%S 4,6,8,10,9,14,16,12,12,22,18,26,21,27,32,34,20,38,24,28,26,46,33,35,

%T 28,30,35,58,39,62,64,36,36,42,40,74,42,45,48,82,44,86,50,51,54,94,66,

%U 56,52,54,56,106,57,110,70,60,60,118,75,122,93,111,128,80,68,134,72,81,74

%N a(n) = the smallest integer > n that is non-coprime to n and has the same number of 1's in its binary representation as n has.

%C a(n) <= 2n since 2n is trivially a multiple of n and multiplying a number by 2 adds a 0 in base 2. - _Stefan Steinerberger_, Oct 17 2008

%H Rémy Sigrist, <a href="/A145256/b145256.txt">Table of n, a(n) for n = 2..65536</a>

%t a[n_] := Block[{}, i = n + 1; While[GCD[i, n] == 1 || Not[DigitCount[n, 2, 1] == DigitCount[i, 2, 1]], i++ ]; i]; Table[a[n], {n, 2, 100}] (* _Stefan Steinerberger_, Oct 17 2008 *)

%o (PARI) a(n) = for (m=n+1, oo, if (gcd(m,n)>1 && hammingweight(m)==hammingweight(n), return (m))) \\ _Rémy Sigrist_, Feb 06 2020

%Y Cf. A145254, A145255, A145257.

%K base,nonn

%O 2,1

%A _Leroy Quet_, Oct 05 2008

%E Edited and corrected by _Stefan Steinerberger_, Oct 17 2008

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 21:09 EDT 2024. Contains 371798 sequences. (Running on oeis4.)