cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A057300 Binary counter with odd/even bit positions swapped; base-4 counter with 1's replaced by 2's and vice versa.

This page as a plain text file.
%I A057300 #112 Aug 12 2025 15:40:29
%S A057300 0,2,1,3,8,10,9,11,4,6,5,7,12,14,13,15,32,34,33,35,40,42,41,43,36,38,
%T A057300 37,39,44,46,45,47,16,18,17,19,24,26,25,27,20,22,21,23,28,30,29,31,48,
%U A057300 50,49,51,56,58,57,59,52,54,53,55,60,62,61,63,128,130,129,131,136,138
%N A057300 Binary counter with odd/even bit positions swapped; base-4 counter with 1's replaced by 2's and vice versa.
%C A057300 A self-inverse permutation of the integers.
%C A057300 a(n) = n if and only if n can be written as 3*Sum_{k>=0} d_i*4^k, where d_i is either 0 or 1. - _Jon Perry_, Oct 06 2012
%C A057300 From _Veselin Jungic_, Mar 03 2015: (Start)
%C A057300 In 1988 A. F. Sidorenko, see the Sidorenko reference, used this sequence as an example of a permutation of the set of positive integers with the property that if positive integers i, j, and k form a 3-term arithmetic progression then the corresponding terms a(i), a(j), and a(k) do not form an arithmetic progression.
%C A057300 In the terminology introduced in the Brown, Jungic, and Poelstra reference, the sequence does not contain "double 3-term arithmetic progressions".
%C A057300 It is not difficult to check that this sequence is with unbounded gaps, i.e., for any positive number m there is a natural number n such that a(n+1) - a(n) > m.
%C A057300 It is an open question if every sequence of integers with bounded gaps must contain a double 3-term arithmetic progression. This problem is equivalent to the well known additive square problem in infinite words: Is it true that any infinite word with a finite set of integers as its alphabet contains two consecutive blocks of the same length and the same sum? For more details about the additive square problem in infinite words see the following references: Ardal, et al.; Brown and Freedman; Freedman; Grytczuk; Halbeisen and Hungerbuhler, and Pirillo and Varricchio.
%C A057300 The sequence was attributed to Sidorenko in P. Hegarty's paper "Permutations avoiding arithmetic patterns". In his paper Hegarty characterized the countably infinite abelian groups for which there exists a bijection mapping arithmetic progressions to non-arithmetic progressions. This was further generalized by Jungic and Sahasrabudhe. (End)
%H A057300 Paul Tek, <a href="/A057300/b057300.txt">Table of n, a(n) for n = 0..16383</a>
%H A057300 H. Ardal, T. Brown, V. Jungic, and J. Sahasrabudhe, <a href="http://www.emis.de/journals/INTEGERS/papers/m21/m21.Abstract.html">On Additive and Abelian Complexity in Infinite Words</a>, INTEGERS: Elect. J. Combin. Number Theory, 12 (2012), A21.
%H A057300 T. C. Brown and A. R. Freedman, <a href="http://people.math.sfu.ca/~vjungic/tbrown/tom-39.pdf">Arithmetic progressions in lacunary sets</a>, Rocky Mountain J. Math., 17 Number 3 (1987), 587-596. doi:<a href="http://dx.doi.org/10.1216/RMJ-1987-17-3-587">10.1216/RMJ-1987-17-3-587</a>
%H A057300 T. Brown, V. Jungic, and A. Poelstra, <a href="http://www.emis.de/journals/INTEGERS/papers/o43/o43.Abstract.html">On 3-term double arithmetic progressions</a>, INTEGERS: Elect. J. Combin. Number Theory, 14 (2014), A43.
%H A057300 A. R. Freedman, <a href="https://www.emis.de/journals/INTEGERS/papers/q33/q33.Abstract.html">Sequences on sets of four numbers</a>, INTEGERS: Elect. J. Combin. Number Theory, 16 (2016), A33.
%H A057300 J. Grytczuk, <a href="http://dx.doi.org/10.1016/j.disc.2007.08.039">Thue type problems for graphs, points and numbers</a>, Discrete Math., 308 (2008), 4419-4429.
%H A057300 L. Halbeisen and N. Hungerbuhler, <a href="http://www.emis.de/journals/INTEGERS/papers/a7/a7.Abstract.html">An application of van der Waerden's theorem in additive number theory</a>, INTEGERS: Elect. J. Combin. Number Theory, 0 (2000), A7.
%H A057300 Peter Hegarty, <a href="https://doi.org/10.37236/1792">Permutations avoiding arithmetic patterns</a>, The Electronic Journal of Combinatorics, 11 (2004), #R39.
%H A057300 V. Jungic and J. Sahasrabudhe, <a href="http://www.combinatorics.org/ojs/index.php/eljc/article/view/v22i2p5">Permutations destroying arithmetic structure</a>, The Electronic Journal of Combinatorics, Volume 22, Issue 2 (2015), Paper #P2.5.
%H A057300 G. Pirillo and S. Varricchio, <a href="https://gdz.sub.uni-goettingen.de/id/PPN362162808_0049">On uniformly repetitive semigroups</a>, Semigroup Forum, 49 (1994), 125-129.
%H A057300 A. F. Sidorenko, <a href="http://dx.doi.org/10.1016/0012-365X(88)90023-4">An infinite permutation without arithmetic progressions</a>, Discrete Math., 69 (1988), 211.
%H A057300 Ralf Stephan, <a href="/somedcgf.html">Some divide-and-conquer sequences ...</a>
%H A057300 Ralf Stephan, <a href="/A079944/a079944.ps">Table of generating functions</a>
%H A057300 <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%H A057300 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A057300 Conjecture: a(2*n) = -2*a(n) + 5*n, a(2*n+1) = -2*a(n) + 5*n + 2. - _Ralf Stephan_, Oct 11 2003
%F A057300 a(4n+k) = 4a(n) + a(k), 0 <= k <= 3. - _Jon Perry_, Oct 06 2012
%F A057300 a(n) = A000695(A059906(n)) + 2*A000695(A059905(n)). - _Antti Karttunen_, Apr 14 2018
%F A057300 From _Peter Munn_, Dec 10 2019: (Start)
%F A057300 a(a(n)) = n.
%F A057300 a(A000695(m) + 2*A000695(n)) = 2*A000695(m) + A000695(n).
%F A057300 a(n OR k) = a(n) OR a(k), where OR is bitwise-or (A003986).
%F A057300 a(n XOR k) = a(n) XOR a(k), where XOR is bitwise exclusive-or (A003987).
%F A057300 a(n AND k) = a(n) AND a(k), where AND is bitwise-and (A004198).
%F A057300 a(A054240(n,k)) = A054240(a(n), a(k)). (End)
%F A057300 a(n) = 5*n/4 - 3*A053985(2*n)/8. - _Alan Michael Gómez Calderón_, May 20 2025
%e A057300 a(31) = a(4*7+3) = 4*a(7) + a(3) = 4*11 + 3 = 47.
%p A057300 a:= proc(n) option remember; `if`(n=0, 0,
%p A057300       a(iquo(n, 4, 'r'))*4+[0, 2, 1, 3][r+1])
%p A057300     end:
%p A057300 seq(a(n), n=0..69);  # _Alois P. Heinz_, Jan 25 2022
%t A057300 Table[FromDigits[IntegerDigits[n,4]/.{1->2,2->1},4],{n,0,70}] (* _Harvey P. Dale_, Aug 24 2017 *)
%o A057300 (PARI) A057300(n) = { my(t=1,s=0); while(n>0, if(1==(n%4),n++,if(2==(n%4),n--)); s += (n%4)*t; n >>= 2; t <<= 2); (s); }; \\ _Antti Karttunen_, Apr 14 2018
%o A057300 (C)
%o A057300 #include <stdint.h>
%o A057300 uint32_t a(uint32_t n) { return ((n & 0x55555555) << 1) | ((n & 0xaaaaaaaa) >> 1); } /* _Falk Hüffner_, Jan 23 2022 */
%Y A057300 Sequences used in definitions of this sequence: A000695, A059905, A059906.
%Y A057300 Sequences with similar definitions: A057301, A126006, A126007, A126008, A163241, A163327.
%Y A057300 A003986, A003987, A004198, A053985, A054240 are used to express relationships between sequence terms.
%K A057300 easy,nonn,base
%O A057300 0,2
%A A057300 _Marc LeBrun_, Aug 24 2000