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-5 of 5 results.

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

A332450 Self-inverse permutation of natural numbers, "Blue code" conjugated by A156552 and its inverse: a(n) = A005940(1+A193231(A156552(n))).

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 16, 8, 9, 27, 14, 18, 100, 11, 25, 7, 210, 12, 256, 20, 21, 147, 38, 45, 15, 385, 10, 98, 1156, 30, 1938, 50, 121, 2187, 35, 125, 234256, 23, 315, 245, 6902, 72, 3496900, 120, 24, 1083, 9699690, 108, 81, 32, 15625, 1458, 65536, 75, 225, 231, 57, 2185, 106, 243, 8836, 771147, 150, 105, 143, 154, 14946, 68, 529, 162
Offset: 1

Views

Author

Antti Karttunen, Feb 15 2020

Keywords

Crossrefs

Cf. A293448 (A057889 similarly conjugated).

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ From A005940
    A156552(n) = {my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ From A156552
    A193231(n) = { my(x='x); subst(lift(Mod(1, 2)*subst(Pol(binary(n), x), x, 1+x)), x, 2) }; \\ From A193231
    A332450(n) = A005940(1+A193231(A156552(n)));

Formula

a(n) = A005940(1+A193231(A156552(n))).
a(A003961(n)) = A332451(a(n)); a(A332451(n)) = A003961(a(n)).
a(n) = A366263(A156552(n)). - Antti Karttunen, Oct 06 2023

A332451 a(n) = A005940(1+A048724(A156552(n))).

Original entry on oeis.org

1, 4, 9, 6, 25, 16, 49, 10, 15, 36, 121, 54, 169, 100, 81, 14, 289, 24, 361, 150, 225, 196, 529, 250, 35, 484, 21, 294, 841, 64, 961, 22, 441, 676, 625, 90, 1369, 1156, 1089, 490, 1681, 144, 1849, 726, 375, 1444, 2209, 686, 77, 60, 1521, 1014, 2809, 40, 1225, 1210, 2601, 2116, 3481, 486, 3721, 3364, 735, 26, 3025, 400
Offset: 1

Views

Author

Antti Karttunen, Feb 15 2020

Keywords

Crossrefs

Cf. A000290, A003961, A005117 (gives the positions of squares), A005940, A008836, A010052, A048724, A156552, A277010, A293448, A332449, A332450.
Permutation of A028260.
Cf. A332460 for complementary sequence (after its initial 1).

Programs

  • PARI
    A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ From A005940
    A048724(n) = bitxor(n, 2*n); \\ From A048724
    A156552(n) = {my(f = factor(n), p2 = 1, res = 0); for(i = 1, #f~, p = 1 << (primepi(f[i, 1]) - 1); res += (p * p2 * (2^(f[i, 2]) - 1)); p2 <<= f[i, 2]); res}; \\ From A156552
    A332451(n) = A005940(1+A048724(A156552(n)));

Formula

a(n) = A005940(1+A048724(A156552(n))).
a(p) = p^2 for all primes p.
For all squarefree numbers u, a(u) = A332449(u) and A010052(a(u)) = 1.
a(A003961(n)) = A003961(a(n)).
a(A293448(n)) = A293448(a(n)).
a(A332450(n)) = A332450(A003961(n)); A332450(a(n)) = A003961(A332450(n)).
A008836(a(n)) = +1 for all n.

A273258 Write the distinct prime divisors p of n in the (PrimePi(p) - 1)-th place, ignoring multiplicity. Decode the resulting number after first reversing the code, ignoring any leading zeros.

Original entry on oeis.org

1, 2, 2, 2, 2, 6, 2, 2, 2, 10, 2, 6, 2, 14, 6, 2, 2, 6, 2, 10, 10, 22, 2, 6, 2, 26, 2, 14, 2, 30, 2, 2, 14, 34, 6, 6, 2, 38, 22, 10, 2, 70, 2, 22, 6, 46, 2, 6, 2, 10, 26, 26, 2, 6, 10, 14, 34, 58, 2, 30, 2, 62, 10, 2, 14, 154, 2, 34, 38, 42, 2, 6, 2, 74, 6, 38, 6, 286, 2, 10, 2, 82, 2, 70, 22, 86
Offset: 1

Views

Author

Michael De Vlieger, Aug 28 2016

Keywords

Comments

Encode n with the function f(n) = noting the distinct prime divisors p of n by writing "1" in the (PrimePi(n) - 1)-th place, e.g, f(6) = f(12) = "11". This function is akin to A054841(n) except we don't note the multiplicity e of p in n, rather merely note "1" if e > 0.
This sequence decodes f(n) by reversing the digits.
If we decode f(n) without reversal, we have A007947(n), since f(n) sets any multiplicity e > 1 of prime divisor p of n to 1.
All terms except a(1) are of the form 2x with x odd. a(1) = 1, since f(1) = "0" and stands unaffected in reversal and decoding, and any zeros to the right of all 1's are lost in reversal. Thus f(15) = "110" reversed becomes "011" -> "11" decoded equals 2 * 3 = 6. Because we lose leading zeros, we always have 1 in position 1, which decoded is interpreted as the factor 2.
a(p) for p prime = 2, since primes are written via f(p) as 1 in the (PrimePi(p)-1)-th place. There is only one 1 in this number (similar to a perfect power of ten decimally) and when it is reversed, the number loses all leading zeros to become "1" -> 2. This also applies to prime powers p^e, since e is rendered as 1 by f(p^e), i.e., f(p^e) = f(p).

Examples

			a(3) = 2 since f(3) = "10" reversed becomes "01", loses leading zeros to become "1" -> 2.
a(6) = a(12) = "11" reversed stays the same -> 2 * 3 = 6.
a(15) = "110" reversed becomes "011", loses leading zeros to become "11" -> 6.
a(42) = "1101" reversed becomes "1011" -> 70 (a(70) = 42).
		

Crossrefs

Cf. A007947, A019565, A030101, A054841 (analogous encoding algorithm), A069799, A087207, A137502, A276379, A293448 (a bijective variant of this sequence).

Programs

  • Mathematica
    Table[Times @@ Prime@ Flatten@ Position[#, 1] &@ Reverse@ If[# == 1, {0}, Function[f, ReplacePart[Table[0, {PrimePi[f[[-1, 1]]]}], #] &@ Map[PrimePi@ First@ # -> 1 &, f]]@ FactorInteger@ #] &@ n, {n, 86}]
  • Scheme
    (define (A273258 n) (A019565 (A030101 (A087207 n)))) ;; Antti Karttunen, Jun 18 2017

Formula

a(n) = A019565(A030101(A087207(n))). - Antti Karttunen, Jun 18 2017
For all n, a(A039956(n)) = A293448(A039956(n)). - Antti Karttunen, Nov 21 2017

A295417 Self-inverse permutation of natural numbers: in prime factorization of n replace each positive prime exponent e with max + min - e, where max = A051903(n) and min = A051904(n).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18, 13, 14, 15, 16, 17, 12, 19, 50, 21, 22, 23, 54, 25, 26, 27, 98, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 250, 41, 42, 43, 242, 75, 46, 47, 162, 49, 20, 51, 338, 53, 24, 55, 686, 57, 58, 59, 450, 61, 62, 147, 64, 65, 66
Offset: 1

Views

Author

Rémy Sigrist, Nov 22 2017

Keywords

Comments

This sequence was inspired by A293448.
This sequence first differs from A293448 at n = 42: a(42) = 42 whereas A293448(42) = 70.
a(A293448(n)) = A293448(a(n)) for any n > 0.
a(n) = n iff n belongs to A072774.
f(n) = f(a(n)) for any n > 0 and f in { A001221, A006530, A007947, A020639, A051903, A051904 }.
The lines visible in the logarithmic scatterplot of the sequence seems to correspond to integer sets where the function A062760 is constant (see logarithmic scatterplot in Links section).

Examples

			For n = 1620:
- 1620 = 2^2 * 3^4 * 5,
- A051903(1620) = 4 and A051904(1620) = 1,
- a(1620) = 2^(4+1-2) * 3^(4+1-4) * 5^(4+1-1) = 2^3 * 3 * 5^4 = 15000.
		

Crossrefs

Programs

  • PARI
    a(n) = { my(f=factor(n)); if(#f~<=1, return(n), my(mi=vecmin(f[,2]), ma=vecmax(f[,2])); return(prod(i=1, #f~, f[i,1]^(ma+mi-f[i,2])))) }

Formula

a(n) = A007947(n)^(A051903(n) + A051904(n)) / n.
Showing 1-5 of 5 results.