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.

Showing 1-10 of 11 results. Next

A163237 a(i,j) = bits of binary expansion of A003188(i) interleaved with that of A003188(j), then converted with A163241.

Original entry on oeis.org

0, 1, 3, 5, 2, 15, 4, 6, 14, 12, 20, 7, 10, 13, 60, 21, 23, 11, 9, 61, 63, 17, 22, 27, 8, 57, 62, 51, 16, 18, 26, 24, 56, 58, 50, 48, 80, 19, 30, 25, 40, 59, 54, 49, 240, 81, 83, 31, 29, 41, 43, 55, 53, 241, 243, 85, 82, 95, 28, 45, 42, 39, 52, 245, 242, 255, 84, 86, 94
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163238. a(n) = A163241(A163233(n)). Transpose: A163239. Cf. A147995.

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

Original entry on oeis.org

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, 37, 39, 44, 46, 45, 47, 16, 18, 17, 19, 24, 26, 25, 27, 20, 22, 21, 23, 28, 30, 29, 31, 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63, 128, 130, 129, 131, 136, 138
Offset: 0

Views

Author

Marc LeBrun, Aug 24 2000

Keywords

Comments

A self-inverse permutation of the integers.
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
From Veselin Jungic, Mar 03 2015: (Start)
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.
In the terminology introduced in the Brown, Jungic, and Poelstra reference, the sequence does not contain "double 3-term arithmetic progressions".
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.
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.
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)

Examples

			a(31) = a(4*7+3) = 4*a(7) + a(3) = 4*11 + 3 = 47.
		

Crossrefs

Sequences used in definitions of this sequence: A000695, A059905, A059906.
Sequences with similar definitions: A057301, A126006, A126007, A126008, A163241, A163327.
A003986, A003987, A004198, A053985, A054240 are used to express relationships between sequence terms.

Programs

  • C
    #include 
    uint32_t a(uint32_t n) { return ((n & 0x55555555) << 1) | ((n & 0xaaaaaaaa) >> 1); } /* Falk Hüffner, Jan 23 2022 */
  • Maple
    a:= proc(n) option remember; `if`(n=0, 0,
          a(iquo(n, 4, 'r'))*4+[0, 2, 1, 3][r+1])
        end:
    seq(a(n), n=0..69);  # Alois P. Heinz, Jan 25 2022
  • Mathematica
    Table[FromDigits[IntegerDigits[n,4]/.{1->2,2->1},4],{n,0,70}] (* Harvey P. Dale, Aug 24 2017 *)
  • 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
    

Formula

Conjecture: a(2*n) = -2*a(n) + 5*n, a(2*n+1) = -2*a(n) + 5*n + 2. - Ralf Stephan, Oct 11 2003
a(4n+k) = 4a(n) + a(k), 0 <= k <= 3. - Jon Perry, Oct 06 2012
a(n) = A000695(A059906(n)) + 2*A000695(A059905(n)). - Antti Karttunen, Apr 14 2018
From Peter Munn, Dec 10 2019: (Start)
a(a(n)) = n.
a(A000695(m) + 2*A000695(n)) = 2*A000695(m) + A000695(n).
a(n OR k) = a(n) OR a(k), where OR is bitwise-or (A003986).
a(n XOR k) = a(n) XOR a(k), where XOR is bitwise exclusive-or (A003987).
a(n AND k) = a(n) AND a(k), where AND is bitwise-and (A004198).
a(A054240(n,k)) = A054240(a(n), a(k)). (End)
a(n) = 5*n/4 - 3*A053985(2*n)/8. - Alan Michael Gómez Calderón, May 20 2025

A163542 The relative direction (0=straight ahead, 1=turn right, 2=turn left) taken by the type I Hilbert's Hamiltonian walk A163357 at the step n.

Original entry on oeis.org

1, 1, 2, 0, 2, 2, 1, 1, 2, 2, 0, 2, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 2, 2, 0, 0, 2, 2, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 2, 0, 2, 2, 1, 1, 2, 2, 0, 2, 1, 1, 2, 0, 2, 2, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 2, 2, 0, 2, 1, 1, 2, 0, 2, 2, 1, 1, 2, 2, 0, 2, 1, 1, 0, 0, 1, 1, 2, 0, 2, 2
Offset: 1

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

a(16*n) = a(256*n) for all n.

Crossrefs

a(n) = A014681(A163543(n)). See also A163540.

Programs

  • Mathematica
    HC = {L[n_ /; IntegerQ[n/2]] :> {F[n], L[n], L[n + 1], R[n + 2]},
       R[n_ /; IntegerQ[(n + 1)/2]] :> {F[n], R[n], R[n + 3], L[n + 2]},
       R[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], F[n + 3]},
       L[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], F[n + 1]},
       F[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], L[n + 3]},
       F[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], R[n + 1]}};
    a[1] = L[0]; Map[(a[n_ /; IntegerQ[(n - #)/16]] :=
        Part[Flatten[a[(n + 16 - #)/16] /. HC /. HC], #]) &, Range[16]];
    Part[a[#] & /@ Range[4^4] /. {L[] -> 2, R[] -> 1, F[_] -> 0},
    2 ;; -1] (* Bradley Klee, Aug 07 2015 *)
  • Scheme
    (define (A163542 n) (A163241 (modulo (- (A163540 (1+ n)) (A163540 n)) 4)))

Formula

a(n) = A163241((A163540(n+1)-A163540(n)) modulo 4).

A163536 The relative direction (0=straight ahead, 1=turn right, 2=turn left) of the Peano curve A163334 at point n.

Original entry on oeis.org

0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2
Offset: 1

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

a(9*n) = a(81*n) for all n.

Crossrefs

Cf. A163534 (direction), A163537 (transposed relative).

Programs

Formula

a(n) = A163241((A163534(n+1)-A163534(n)) modulo 4).
a(n) = A014681(A163537(n)).

Extensions

Name corrected by Kevin Ryde, Aug 29 2020

A163239 Transpose of array A163237.

Original entry on oeis.org

0, 3, 1, 15, 2, 5, 12, 14, 6, 4, 60, 13, 10, 7, 20, 63, 61, 9, 11, 23, 21, 51, 62, 57, 8, 27, 22, 17, 48, 50, 58, 56, 24, 26, 18, 16, 240, 49, 54, 59, 40, 25, 30, 19, 80, 243, 241, 53, 55, 43, 41, 29, 31, 83, 81, 255, 242, 245, 52, 39, 42, 45, 28, 95, 82, 85, 252, 254, 246
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Comments

The top left 8x8 corner of this array
+0 +3 15 12 60 63 51 48
+1 +2 14 13 61 62 50 49
+5 +6 10 +9 57 58 54 53
+4 +7 11 +8 56 59 55 52
20 23 27 24 40 43 39 36
21 22 26 25 41 42 38 37
17 18 30 29 45 46 34 33
16 19 31 28 44 47 35 32
corresponds with Adamson's "H-bond codon-anticodon magic square" (see page 287 in Pickover's book):
CCC CCU CUU CUC UUC UUU UCU UCC
CCA CCG CUG CUA UUA UUG UCG UCA
CAA CAG CGG CGA UGA UGG UAG UAA
CAC CAU CGU CGC UGC UGU UAU UAC
AAC AAU AGU AGC GGC GGU GAU GAC
AAA AAG AGG AGA GGA GGG GAG GAA
ACA ACG AUG AUA GUA GUG GCG GCA
ACC ACU AUU AUC GUC GUU GCU GCC
when the base-triples are interpreted as quaternary (base-4) numbers, with the following rules: C = 0, A = 1, G = 2, U = 3.

References

  • Clifford A. Pickover, The Zen of Magic Squares, Circles, and Stars: An Exhibition of Surprising Structures across Dimensions, Princeton University Press, 2002, pp. 285-289.

Crossrefs

Inverse: A163240. a(n) = A163241(A163235(n)). Transpose: A163237. Cf. A147995.

A163543 The relative direction (0=straight ahead, 1=turn right, 2=turn left) taken by the type I Hilbert's Hamiltonian walk A163359 at the step n.

Original entry on oeis.org

2, 2, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 2, 2, 0, 2, 1, 1, 2, 0, 2, 2, 1, 1, 2, 2, 0, 2, 1, 1, 0, 0, 1, 1, 2, 0, 2, 2, 1, 1, 2, 2, 0, 2, 1, 1, 2, 0, 2, 2, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 2, 0, 2, 2, 1, 1, 2, 2, 0, 2, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 2, 2, 1, 1, 0, 1, 2, 2, 0, 0, 2, 2, 1, 0, 1, 1
Offset: 1

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

a(16*n) = a(256*n) for all n.

Crossrefs

a(n) = A014681(A163542(n)). See also A163541.

Programs

  • Mathematica
    HC = {
    L[n_ /; IntegerQ[n/2]] :> {F[n], L[n], L[n + 1], R[n + 2]},
    R[n_ /; IntegerQ[(n + 1)/2]] :> {F[n], R[n], R[n + 3], L[n + 2]},
    R[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], F[n + 3]},
    L[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], F[n + 1]},
    F[n_ /; IntegerQ[n/2]] :> {L[n], R[n + 1], R[n], L[n + 3]},
    F[n_ /; IntegerQ[(n + 1)/2]] :> {R[n], L[n + 3], L[n], R[n + 1]}};
    a[1] = F[0]; Map[(a[n_ /; IntegerQ[(n - #)/16] ] := Part[Flatten[a[(n + 16 - #)/16] /. HC /. HC],#]) &, Range[16]];
    Part[a[#] & /@ Range[4^4] /. {L[] -> 2, R[] -> 1, F[] -> 0}, 2 ;; -1] (* _Bradley Klee, Aug 06 2015 *)
  • Scheme
    (define (A163543 n) (A163241 (modulo (- (A163541 (1+ n)) (A163541 n)) 4)))

Formula

a(n) = A163241((A163541(n+1)-A163541(n)) modulo 4).

A163238 Inverse permutation to A163237.

Original entry on oeis.org

0, 1, 4, 2, 6, 3, 7, 11, 24, 18, 12, 17, 9, 13, 8, 5, 28, 21, 29, 37, 10, 15, 22, 16, 31, 39, 30, 23, 58, 48, 38, 47, 112, 98, 84, 97, 73, 85, 72, 61, 40, 49, 60, 50, 70, 59, 71, 83, 35, 43, 34, 27, 62, 52, 42, 51, 32, 25, 33, 41, 14, 19, 26, 20, 120, 105, 121, 137, 78
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163237. a(n) = A163234(A163241(n)). Cf. A163240.

A163240 Inverse permutation to A163239.

Original entry on oeis.org

0, 2, 4, 1, 9, 5, 8, 13, 24, 17, 12, 18, 6, 11, 7, 3, 35, 27, 34, 43, 14, 20, 26, 19, 32, 41, 33, 25, 62, 51, 42, 52, 112, 97, 84, 98, 70, 83, 71, 59, 40, 50, 60, 49, 73, 61, 72, 85, 28, 37, 29, 21, 58, 47, 38, 48, 31, 23, 30, 39, 10, 16, 22, 15, 135, 119, 134, 151, 90
Offset: 0

Views

Author

Antti Karttunen, Jul 29 2009

Keywords

Crossrefs

Inverse: A163239. a(n) = A163236(A163241(n)). Cf. A163238.

A163537 The relative direction (0=straight ahead, 1=turn right, 2=turn left) of the Peano curve A163336 at point n.

Original entry on oeis.org

0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 2, 2, 0, 0, 0, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 1, 1
Offset: 1

Views

Author

Antti Karttunen, Aug 01 2009

Keywords

Comments

a(9*n) = a(81*n) for all n.

Crossrefs

Cf. A163535 (direction), A163536 (transposed relative).

Programs

Formula

a(n) = A163241((A163535(n+1)-A163535(n)) modulo 4).
a(n) = A014681(A163536(n)).

Extensions

Name corrected by Kevin Ryde, Aug 29 2020

A361946 If the base-4 expansion of n starts with the digit 1, then replace 2's by 3's and vice versa; if it starts with the digit 2, then replace 1's by 3's and vice versa; if it starts with the digit 3, then replace 1's by 2's and vice versa; a(0) = 0.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 7, 6, 8, 11, 10, 9, 12, 14, 13, 15, 16, 17, 19, 18, 20, 21, 23, 22, 28, 29, 31, 30, 24, 25, 27, 26, 32, 35, 34, 33, 44, 47, 46, 45, 40, 43, 42, 41, 36, 39, 38, 37, 48, 50, 49, 51, 56, 58, 57, 59, 52, 54, 53, 55, 60, 62, 61, 63, 64, 65, 67, 66
Offset: 0

Views

Author

Rémy Sigrist, Apr 01 2023

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 539:
- the base-4 expansion of 539 is "20123",
- it starts with the digit 2, so we replace 1's by 3's and vice versa,
- so the base-4 expansion of a(539) is "20321", and a(539) = 569.
		

Crossrefs

Programs

  • PARI
    a(n) = { my (q = digits(n, 4), m = if (#q, [ [0,1,3,2], [0,3,2,1], [0,2,1,3] ][q[1]], [0,1,2,3])); fromdigits(apply (d -> m[1+d], q), 4); }

Formula

a(n) = A163241(n) when A122587(n) = 1.
a(n) = A048647(n) when A122587(n) = 2.
a(n) = A057300(n) when A122587(n) = 3.
a(n) = n iff n = d * A000695(k) for some d in {1, 2, 3} and some k >= 0.
Showing 1-10 of 11 results. Next