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 13 results. Next

A266635 Permutation of natural numbers: a(n) = A126760(A264965(A007310(n))).

Original entry on oeis.org

1, 3, 2, 5, 7, 9, 6, 19, 4, 8, 13, 15, 23, 11, 27, 16, 25, 17, 22, 10, 21, 20, 49, 65, 12, 73, 41, 61, 37, 24, 29, 77, 14, 55, 47, 79, 31, 26, 43, 59, 18, 67, 35, 38, 81, 33, 62, 54, 57, 46, 78, 30, 70, 53, 74, 42, 69, 34, 163, 50, 58, 45, 66, 91, 71, 28, 60, 44, 76, 39, 68, 36, 63, 52, 217, 32, 64, 51, 80, 109
Offset: 1

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Comments

Permutation induced when A264965 is restricted to numbers neither divisible by 2 nor 3 (A007310).

Crossrefs

Programs

Formula

a(n) = A126760(A264965(A007310(n))).

A266641 Permutation of nonnegative integers: a(n) = A264965(2*n) / 2.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 11, 8, 9, 10, 13, 12, 7, 14, 15, 32, 23, 18, 35, 20, 33, 26, 19, 24, 29, 38, 27, 28, 17, 30, 37, 16, 21, 34, 113, 36, 41, 50, 87, 40, 31, 42, 77, 104, 45, 110, 101, 96, 25, 22, 69, 68, 95, 54, 47, 56, 39, 86, 83, 60, 59, 74, 99, 92, 65, 114, 97, 44, 81, 70, 49, 72, 89, 82, 75, 88, 73, 66, 121, 80, 51
Offset: 0

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Crossrefs

Formula

a(n) = A264965(2*n) / 2.
As a composition of related permutations:
a(n) = A263272(A057889(n)).

A266643 Permutation of nonnegative integers: a(n) = A264965(3*n) / 3.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Jan 04 2016

Keywords

Crossrefs

Formula

a(n) = A264965(3*n) / 3.
As a composition of related permutations:
a(n) = A263273(A246200(n)).

A264969 Cycle length of n under bijection A264965 / A264966.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 5, 1, 5, 3, 2, 1, 5, 1, 5, 1, 2, 3, 5, 1, 5, 3, 1, 1, 5, 1, 22, 2, 3, 9, 7, 1, 22, 9, 3, 1, 22, 2, 7, 4, 2, 9, 1, 1, 7, 9, 4, 4, 7, 1, 5, 1, 3, 9, 5, 1, 1, 3, 2, 2, 5, 2, 22, 1, 2, 9, 18, 1, 7, 3, 4, 4, 18, 4, 7, 1, 2, 3, 18, 1, 3, 10, 3, 10, 18, 1, 3, 8, 6, 3, 22, 2, 22, 9, 4, 4, 18, 3, 17, 10, 4, 10, 6, 1, 3, 3, 6, 1, 18, 4, 17, 8, 3, 3, 10, 1, 7
Offset: 0

Views

Author

Antti Karttunen, Dec 06 2015

Keywords

Comments

By convention: a(n) = 0 if the cycle where n resides can be proven to be infinite. a(n) = -1 is the placeholder value if the cycle where n resides is only suspected to be infinite.
Is n=262 the first representative of runaway cycle? See A264972 and A264973.

Examples

			A264965(5) = 7 and A264965(7) = 5, thus a(5) = a(7) = 2.
		

Crossrefs

Programs

  • Scheme
    ;; Very naive program which succumbs to the first infinite cycle:
    (define (A264969 n) (let loop ((s 1) (next (A264965 n))) (if (equal? next n) s  (loop (+ 1 s) (A264965 next)))))

A264972 Trajectory of 262 under repeated application of the permutation A264965: a(0) = 262; for n >= 1, a(n) = A264965(a(n-1)).

Original entry on oeis.org

262, 670, 1450, 1690, 2158, 4246, 19522, 18410, 34678, 36926, 118882, 146998, 290566, 377966, 240038, 381466, 407054, 178898, 147146, 149714, 159458, 149378, 129242, 117958, 157822, 350014, 489878, 180770, 155930, 395686, 510386, 292426, 514294, 503114, 264490, 435670, 482882, 311674, 452774, 353570, 323374, 369638, 321926, 293726
Offset: 0

Views

Author

Antti Karttunen, Dec 06 2015

Keywords

Comments

The trajectory is probably infinite, not periodic.

Examples

			a(0) = 262 by definition. Its binary representation is A007088(262) = 100000110. When we reverse the significant prefix (i.e., leave the trailing zeros where they are), we get 386 (A007088(386) = 110000010). 386's ternary representation is A007089(386) = 112022. Reversing the significant prefix (now the whole expansion because no trailing zeros present), we get 220211 (= A007089(670)), thus a(1) = 670.
		

Crossrefs

Formula

a(0) = 262; for n >= 1, a(n) = A264965(a(n-1)).

A263273 Bijective base-3 reverse: a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Comments

Here the base-3 reverse has been adjusted so that the maximal suffix of trailing zeros (in base-3 representation A007089) stays where it is at the right side, and only the section from the most significant digit to the least significant nonzero digit is reversed, thus making this sequence a self-inverse permutation of nonnegative integers.
Because successive powers of 3 and 9 modulo 2, 4 and 8 are always either constant 1, 1, 1, ... or alternating 1, -1, 1, -1, ... it implies similar simple divisibility rules for 2, 4 and 8 in base 3 as e.g. 3, 9 and 11 have in decimal base (see the Wikipedia-link). As these rules do not depend on which direction they are applied from, it means that this bijection preserves the fact whether a number is divisible by 2, 4 or 8, or whether it is not. Thus natural numbers are divided to several subsets, each of which is closed with respect to this bijection. See the Crossrefs section for permutations obtained from these sections.
When polynomials over GF(3) are encoded as natural numbers (coefficients presented with the digits of the base-3 expansion of n), this bijection works as a multiplicative automorphism of the ring GF(3)[X]. This follows from the fact that as there are no carries involved, the multiplication (and thus also the division) of such polynomials could be as well performed by temporarily reversing all factors (like they were seen through mirror). This implies also that the sequences A207669 and A207670 are closed with respect to this bijection.

Examples

			For n = 15, A007089(15) = 120. Reversing this so that the trailing zero stays at the right yields 210 = A007089(21), thus a(15) = 21 and vice versa, a(21) = 15.
		

Crossrefs

Bisections: A264983, A264984.
Permutations induced by various sections: A263272 (a(2n)/2), A264974 (a(4n)/4), A264978 (a(8n)/8), A264985, A264989.
Cf. also A004488, A140263, A140264, A246207, A246208 (other base-3 related permutations).

Programs

  • Mathematica
    r[n_] := FromDigits[Reverse[IntegerDigits[n, 3]], 3]; b[n_] := n/ 3^IntegerExponent[n, 3]; c[n_] := n/b[n]; a[0]=0; a[n_] := r[b[n]]*c[n]; Table[a[n], {n, 0, 80}] (* Jean-François Alcover, Dec 29 2015 *)
  • Python
    from sympy import factorint
    from sympy.ntheory.factor_ import digits
    from operator import mul
    def a030102(n): return 0 if n==0 else int(''.join(map(str, digits(n, 3)[1:][::-1])), 3)
    def a038502(n):
        f=factorint(n)
        return 1 if n==1 else reduce(mul, [1 if i==3 else i**f[i] for i in f])
    def a038500(n): return n/a038502(n)
    def a(n): return 0 if n==0 else a030102(a038502(n))*a038500(n) # Indranil Ghosh, May 22 2017
  • Scheme
    (define (A263273 n) (if (zero? n) n (* (A030102 (A038502 n)) (A038500 n))))
    

Formula

a(0) = 0; for n >= 1, a(n) = A030102(A038502(n)) * A038500(n).
Other identities. For all n >= 0:
a(3*n) = 3*a(n).
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
A010873(a(n)) = 0 if and only if A010873(n) = 0. [See the comments section.]

A057889 Bijective bit-reverse of n: keep the trailing zeros in the binary expansion of n fixed, but reverse all the digits up to that point.

Original entry on oeis.org

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

Views

Author

Marc LeBrun, Sep 25 2000

Keywords

Comments

The original name was "Bit-reverse of n, including as many leading as trailing zeros." - Antti Karttunen, Dec 25 2024
A permutation of integers consisting only of fixed points and pairs. a(n)=n when n is a binary palindrome (including as many leading as trailing zeros), otherwise a(n)=A003010(n) (i.e. n has no axis of symmetry). A057890 gives the palindromes (fixed points, akin to A006995) while A057891 gives the "antidromes" (pairs). See also A280505.
This is multiplicative in domain GF(2)[X], i.e. with carryless binary arithmetic. A193231 is another such permutation of natural numbers. - Antti Karttunen, Dec 25 2024

Examples

			a(6)=6 because 0110 is a palindrome, but a(11)=13 because 1011 reverses into 1101.
		

Crossrefs

Cf. A030101, A000265, A006519, A006995, A057890, A057891, A280505, A280508, A331166 [= min(n,a(n))], A366378 [k for which a(k) = k (mod 3)], A369044 [= A014963(a(n))].
Similar permutations for other bases: A263273 (base-3), A264994 (base-4), A264995 (base-5), A264979 (base-9).
Other related (binary) permutations: A056539, A193231.
Compositions of this permutation with other binary (or other base-related) permutations: A264965, A264966, A265329, A265369, A379471, A379472.
Compositions with permutations involving prime factorization: A245450, A245453, A266402, A266404, A293448, A366275, A366276.
Other derived permutations: A246200 [= a(3*n)/3], A266351, A302027, A302028, A345201, A356331, A356332, A356759, A366389.
See also A235027 (which is not a permutation).

Programs

  • Mathematica
    Table[FromDigits[Reverse[IntegerDigits[n, 2]], 2]*2^IntegerExponent[n, 2], {n, 71}] (* Ivan Neretin, Jul 09 2015 *)
  • PARI
    A030101(n) = if(n<1,0,subst(Polrev(binary(n)),x,2));
    A057889(n) = if(!n,n,A030101(n/(2^valuation(n,2))) * (2^valuation(n, 2))); \\ Antti Karttunen, Dec 25 2024
  • Python
    def a(n):
        x = bin(n)[2:]
        y = x[::-1]
        return int(str(int(y))+(len(x) - len(str(int(y))))*'0', 2)
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 11 2017
    
  • Python
    def A057889(n): return int(bin(n>>(m:=(~n&n-1).bit_length()))[-1:1:-1],2)<Chai Wah Wu, Dec 25 2024
    

Formula

a(n) = A030101(A000265(n)) * A006519(n), with a(0)=0.

Extensions

Clarified the name with May 30 2016 comment from N. J. A. Sloane, and moved the old name to the comments - Antti Karttunen, Dec 25 2024

A264966 Permutation of nonnegative integers: a(n) = A057889(A263273(n)).

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Dec 05 2015

Keywords

Comments

Perform an adjusted reverse of n in base 3, followed by another adjusted reverse in base 2. "Adjusted reverse" here means a digit-reversing operation where the suffix of trailing zeros (in the base in question) stays as it is at the right side, and only the section from the most significant digit to the least significant nonzero digit is reversed.

Crossrefs

Inverse: A264965.
Cf. also A264967, A264968.

Programs

Formula

a(n) = A057889(A263273(n)).
Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A265369 Self-inverse permutation of nonnegative integers: a(n) = A057889(A263273(A057889(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 11, 12, 25, 26, 21, 16, 19, 18, 17, 20, 15, 22, 59, 24, 13, 14, 27, 28, 29, 30, 41, 64, 39, 58, 53, 36, 97, 98, 33, 40, 31, 66, 121, 44, 63, 50, 61, 48, 73, 46, 105, 100, 35, 54, 65, 56, 57, 34, 23, 60, 47, 82, 45, 32, 55, 42, 137, 68, 69, 142, 131, 72, 49, 74, 219, 76, 155, 234, 79, 80, 81, 62, 173
Offset: 0

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Crossrefs

Programs

Formula

a(n) = A057889(A263273(A057889(n))).
As a composition of related permutations:
a(n) = A264966(A057889(n)).
a(n) = A057889(A264965(n)).
Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]

A265329 Self-inverse permutation of nonnegative integers: a(n) = A263273(A057889(A263273(n))).

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 17, 12, 19, 26, 15, 16, 11, 18, 13, 20, 21, 22, 55, 24, 25, 14, 27, 28, 65, 30, 67, 32, 39, 38, 35, 36, 37, 34, 33, 40, 145, 42, 73, 100, 45, 46, 61, 48, 79, 226, 219, 76, 121, 54, 23, 56, 57, 70, 59, 60, 47, 82, 63, 64, 29, 66, 31, 68, 81, 58, 217, 72, 43, 74, 75, 52, 193, 174, 49, 80, 69, 62, 221
Offset: 0

Views

Author

Antti Karttunen, Jan 02 2016

Keywords

Crossrefs

Programs

Formula

a(n) = A263273(A057889(A263273(n))).
As a composition of related permutations:
a(n) = A264965(A263273(n)).
a(n) = A263273(A264966(n)).
Other identities. For all n >= 0:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
Showing 1-10 of 13 results. Next