# [seqfan] Re: Project: sequences obtained from Gaussian Integers via Penney's binary method of encoding?

Андрей Заболотский zabolotis at mail.ru
Wed Sep 21 00:38:50 CEST 2016

```Ah, I see, thanks.

Khmelnik's text is quite obscure because it describes the general case, but Examples 1 and 2 in Section 6 are related only to base i-1. I have implemented the negation using just columns 1, 3, 6, and 7 of table 4. Here is the Python code:  http://pastebin.com/aCnECyj8  (it can be made much better). And yes, the bit of the number being negated is either flipped or not depending on the carry which is denoted as Pi and can take values 0, 1, i, -i, 1+i.

First 100 numbers negated are:
0, 29, 58, 7, 116, 25, 14, 3, 232, 21, 50, 239, 28, 17, 6, 235, 464, 13, 42, 471, 100, 9, 478, 467, 56, 5, 34, 63, 12, 1, 470, 59, 928, 957, 26, 935, 84, 953, 942, 931, 200, 949, 18, 207, 956, 945, 934, 203, 112, 941, 10, 119, 68, 937, 126, 115, 24, 933, 2, 31, 940, 929, 118, 27, 1856, 1885, 1914, 1863, 52, 1881, 1870, 1859, 168, 1877, 1906, 175, 1884, 1873, 1862, 171, 400, 1869, 1898, 407, 36, 1865, 414, 403, 1912, 1861, 1890, 1919, 1868, 1857, 406, 1915, 224, 253, 1882, 231

>Суббота, 17 сентября 2016, 10:48 +03:00 от Kevin Ryde via SeqFan <seqfan at list.seqfan.eu>:
>
>zabolotis at mail.ru (Андрей Заболотский) writes:
>>
>> Well, I get 29, 28, 17, 16, 205, 204, 193, 192, 221, 220..., which is really A256441.
>
>Oh yes that's n on negative X axis.  I was negating the complex z,
>eg. with gp
>
>  point(n)=subst(Pol(binary(n)),'x,I-1);
>  point(5)  ==   1-2*I
>  point(25) == -(1-2*I)
>
>so n=5 negates as neg(5)=25, and vice versa neg(25)=5,
>neg(n)=unpoint(-point(n)).
>
>Looks like there's a pattern to the bit flips going n to neg(n), so that
>bitxor(n,neg(n)) has 1-bits as runs 11100 or 100.  I imagine that would
>follow from Khmelnik's table of how "borrow" propagates upwards.
>
>--
>Seqfan Mailing list -  http://list.seqfan.eu/

```