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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A206853 a(1)=1, for n>1, a(n) is the least number > a(n-1) such that the Hamming distance D(a(n-1), a(n)) = 2. 21
1, 2, 4, 7, 11, 13, 14, 22, 26, 28, 31, 47, 55, 59, 61, 62, 94, 110, 118, 122, 124, 127, 191, 223, 239, 247, 251, 253, 254, 382, 446, 478, 494, 502, 506, 508, 511, 767, 895, 959, 991, 1007, 1015, 1019, 1021, 1022, 1534, 1790, 1918, 1982, 2014, 2030, 2038, 2042 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

For integers a, b, denote by a<+>b the least c>=a, such that D(a,c)=b (note that, generally speaking, a<+>b differs from b<+>a). Then a(n+1)=a(n)<+>2. Thus this sequence is a Hamming analog of odd numbers 1,3,5,...

A Hamming analog of nonnegative integers is A000225 and a Hamming analog of the triangular numbers is A000975.

All terms are odious (A000069).

LINKS

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

MAPLE

read("transforms");

Hamming := proc(a, b)

        XORnos(a, b) ;

        wt(%) ;

end proc:

Dplus := proc(a, b)

        for c from a to 1000000 do

                if Hamming(a, c)=b then

                        return c;

                end if;

        end do:

        return -1 ;

end proc:

A206853 := proc(n)

        option remember;

        if n = 1 then

                1;

        else

                Dplus(procname(n-1), 2) ;

        end if;

end proc: # R. J. Mathar, Apr 05 2012

MATHEMATICA

myHammingDistance[n_, m_] := Module[{g = Max[m, n], h = Min[m, n]}, b1 = IntegerDigits[g, 2]; b2 = IntegerDigits[h, 2, Length[b1]]; HammingDistance[b1, b2]]; t = {1}; Do[If[myHammingDistance[t[[-1]], n] == 2, AppendTo[t, n]], {n, 2, 2042}]; t (* T. D. Noe, Mar 07 2012 *)

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

PROG

(PARI) next_A206853(n)={my(b=binary(n)); until(norml2(binary(n)-b)==2, n++>=2^#b & b=concat(0, b)); n}

print1(n=1); for(i=1, 99, print1(", "n=next_A206853(n)))  \\ M. F. Hasler, Apr 07 2012

CROSSREFS

Cf. A000225, A205509, A205510, A205511, A205302, A205649, A205533, A122565, A206852, A000069.

Cf. A207063 (with even binary weight). - Alois P. Heinz, Feb 16 2012

Sequence in context: A249594 A127575 A240106 * A229618 A087285 A107791

Adjacent sequences:  A206850 A206851 A206852 * A206854 A206855 A206856

KEYWORD

nonn,base

AUTHOR

Vladimir Shevelev, Feb 13 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 May 23 19:46 EDT 2017. Contains 286926 sequences.