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

 

Logo

"Email this user" was broken Aug 14 to 9am Aug 16. If you sent someone a message in this period, please send it again.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A182187 a(n) is the least m>=n, such that the Hamming distance D(n,m)=2. 5
3, 2, 4, 5, 7, 6, 10, 11, 11, 10, 12, 13, 15, 14, 22, 23, 19, 18, 20, 21, 23, 22, 26, 27, 27, 26, 28, 29, 31, 30, 46, 47, 35, 34, 36, 37, 39, 38, 42, 43, 43, 42, 44, 45, 47, 46, 54, 55, 51, 50, 52, 53, 55, 54, 58, 59, 59, 58, 60, 61, 63, 62, 94, 95, 67, 66, 68 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,1

COMMENTS

a(n) = n<+>2 (see comment in A206853).

LINKS

Alois P. Heinz, Table of n, a(n) for n = 0..1000

FORMULA

If n is odd, then a(n) = n+2^(A007814(n+1)-1); if n==2 (mod 4), then a(n) = n+2^(A007814(n+2)-1); if n==0 (mod 4), then a(n) = n+3.

Using this formula, we can prove conjecture formulated in comment in A209554 in case k=2. Moreover, let us show that if N has not the forms 8*t, 8*t+1, then it could be represented in form n<+>2. Indeed, in cases N=8*t+2, 8*t+4, 8*t+6, 8*t+3, 8*t+5 and 8*t+7 it is sufficient to choose n=N-4, n=N-2, n=N-1, n=N-3, n=N-2 and n=N-3 respectively; in cases 8*t, 8*t+1, for every choice of n<=N, we do not obtain the equality n<+>2 = N.

In addition, note that n<+>1 = n+2^A007814(n+1) = A086799(n+1).

MAPLE

HD:= proc(i, j) local d, n, m; d, n, m:= 0, i, j;

       while n>0 or m>0 do

           d:= d +abs(irem(n, 2, 'n') -irem(m, 2, 'm'))

       od; d

     end:

a:= proc(n) local c;

      for c from n do if HD(n, c)=2 then return c fi od

    end:

seq (a(n), n=0..100);  # Alois P. Heinz, Apr 17 2012

MATHEMATICA

t={}; Do[i=n+1; While[Count[IntegerDigits[BitXor[n, i], 2], 1]!=2, i++]; AppendTo[t, i], {n, 0, 66}]; t (* Jayanta Basu, May 26 2013 *)

PROG

(Sage)

def A182187(n):

    S = n.bits(); T = S; c = n; L = len(S)

    while true:

         H = sum(a != b for a, b in zip(S, T))

         if H == 2: return c

         c += 1; T = c.bits()

         if len(T) > L: L += 1; S.append(0)

[A182187(n) for n in (0..66)]   # Peter Luschny, May 26 2013

CROSSREFS

Cf. A205509, A205510, A205511, A205302, A205649, A205533, A122565, A206852, A206853, A206960, A207063, A209544, A209554, A007814, A086799.

Sequence in context: A056011 A117123 A116966 * A163241 A234027 A165279

Adjacent sequences:  A182184 A182185 A182186 * A182188 A182189 A182190

KEYWORD

nonn,base

AUTHOR

Vladimir Shevelev, Apr 17 2012

EXTENSIONS

More terms from Alois P. Heinz, Apr 17 2012

STATUS

approved

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 August 20 17:26 EDT 2017. Contains 290837 sequences.