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

A054429 Simple self-inverse permutation of natural numbers: List each block of 2^n numbers (from 2^n to 2^(n+1) - 1) in reverse order.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(n) gives the position of the inverse of the n-th term in the full Stern-Brocot tree: A007305(a(n)+2) = A047679(n) and A047679(a(n)) = A007305(n+2). - Reinhard Zumkeller, Dec 22 2008
From Gary W. Adamson, Jun 21 2012: (Start)
The mapping and conversion rules are as follows:
By rows, we have ...
1;
3, 2;
7, 6, 5, 4;
15, 14, 13, 12, 11, 10, 9, 8;
... onto which we are to map one-half of the Stern-Brocot infinite Farey Tree:
1/2
1/3, 2/3
1/4, 2/5, 3/5, 3/4
1/5, 2/7, 3/8, 3/7, 4/7, 5/8, 5/7, 4/5
...
The conversion rules are: Convert the decimal to binary, adding a duplicate of the rightmost binary term to its right. For example, 10 = 1010, which becomes 10100. Then, from the left, record the number of runs = [1,1,1,2], the continued fraction representation of 5/8. Check: 10 decimal corresponds to 5/8 as shown in the overlaid mapping. Take decimal 9 = 1001 which becomes 10011, with a continued fraction representation of [1,2,2] = 5/7. Check: 9 decimal corresponds to 5/7 in the Farey Tree map. (End)
From Indranil Ghosh, Jan 19 2017: (Start)
a(n) is the value generated when n is converted into its Elias gamma code, the 1's and 0's are interchanged and the resultant is converted back to its decimal value for all values of n > 1. For n = 1, A054429(n) = 1 but after converting 1 to Elias gamma code, interchanging the 1's and 0's and converting it back to decimal, the result produced is 0.
For example, let n = 10. The Elias gamma code for 10 is '1110010'. After interchanging the 1's and 0's it becomes "0001101" and 1101_2 = 13_10. So a(10) = 13. (End)
From Yosu Yurramendi, Mar 09 2017 (similar to Zumkeller's comment): (Start)
A002487(a(n)) = A002487(n+1), A002487(a(n)+1) = A002487(n), n > 0.
A162909(a(n)) = A162910(n), A162910(a(n)) = A162909(n), n > 0.
A162911(a(n)) = A162912(n), A162912(a(n)) = A162911(n), n > 0.
A071766(a(n)) = A245326(n), A245326(a(n)) = A071766(n), n > 0.
A229742(a(n)) = A245325(n), A245325(a(n)) = A229742(n), n > 0.
A020651(a(n)) = A245327(n), A245327(a(n)) = A020651(n), n > 0.
A020650(a(n)) = A245328(n), A245328(a(n)) = A020650(n), n > 0. (End)
From Yosu Yurramendi, Mar 29 2017: (Start)
A063946(a(n)) = a(A063946(n)) = A117120(n), n > 0.
A065190(a(n)) = a(A065190(n)) = A092569(n), n > 0.
A258746(a(n)) = a(A258746(n)) = A165199(n), n > 0.
A258996(a(n)) = a(A258996(n)), n > 0.
A117120(a(n)) = a(A117120(n)), n > 0.
A092569(a(n)) = a(A092569(n)), n > 0. (End)

Crossrefs

See also A054424, A054430.
{A000027, A054429, A059893, A059894} form a 4-group.
This is Guy Steele's sequence GS(6, 5) (see A135416).

Programs

  • Haskell
    a054429 n = a054429_list !! (n-1)
    a054429_list = f [1..] where
       f xs@(x:_) = reverse us ++ f vs where (us, vs) = splitAt x xs
    -- Reinhard Zumkeller, Jun 01 2015, Feb 21 2014
    
  • Maple
    A054429 := n -> 3*2^ilog2(n) - n - 1:
    seq(A054429(n), n = 1..70); # [Updated by Peter Luschny, Apr 24 2024]
  • Mathematica
    Flatten[Table[Range[2^(n+1)-1,2^n,-1],{n,0,6}]] (* Harvey P. Dale, Dec 17 2013 *)
  • PARI
    A054429(n)= 3<<#binary(n\2)-n-1 \\ M. F. Hasler, Aug 18 2014
    
  • Python
    from itertools import count, islice
    def A054429_gen(): # generator of terms
        return (m for n in count(0) for m in range((1<A054429_list = list(islice(A054429_gen(),30)) # Chai Wah Wu, Jul 27 2023
  • R
    maxblock <- 10 # by choice
    a <- NULL
    for(m in 0:maxblock) a <- c(a, rev(2^m:(2^(m+1)-1)))
    a
    # Yosu Yurramendi, Mar 10 2017
    

Formula

a(n) = ReflectBinTreePermutation(n).
a(n) = if n=1 then 1 else 2*a(floor(n/2)) + 1 - n mod 2. - Reinhard Zumkeller, Feb 18 2003
G.f.: 1/(1-x) * ((x-2x^2)/(1-x) + Sum_{k>=0} 3*2^k*x^2^k). - Ralf Stephan, Sep 15 2003
A000120(a(n)) = A000120(A059894(n)) = A023416(n) + 1. - Ralf Stephan, Oct 05 2003
A115310(n, 1) = a(n). - Reinhard Zumkeller, Jan 20 2006
a(1) = 1, a(2^(m+1) + k) = a(2^m+k) + 2^(m+1),
a(2^(m+1) + 2^m+k) = a(2^m+k) + 2^m, m >= 0, 0 <= k < 2^m. - Yosu Yurramendi, Apr 06 2017
a(n) = A117120(A063946(n)) = A063946(A117120(n)) = A092569(A065190(n)) = A065190(A092569(n)), n > 0. - Yosu Yurramendi, Apr 10 2017
a(n) = 3*A053644(n) - n - 1. - Alan Michael Gómez Calderón, Feb 28 2025

A106649 Replace each digit d (except the leading one) of n with 9-d.

Original entry on oeis.org

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

Views

Author

Zak Seidov, May 12 2005

Keywords

Comments

By definition, one-digit numbers do not change.
Differs from A003100 starting with a(21)=29: A003100(21)=20.

Crossrefs

Programs

  • Mathematica
    a[n_]:=FromDigits[Flatten[{IntegerDigits[n][[1]], Map[9-#&, Drop[IntegerDigits[n], 1]]}]];Table[a[n], {n, 0, 100}]

Formula

a(n) = n if n < 10, otherwise 10*a(floor(n/10)) + 9 - n mod 10; a self-inverse permutation of the natural numbers, A115310(n+8, 9) = a(n) for n > 0. - Reinhard Zumkeller, Jan 20 2006 [corrected by Georg Fischer, Jun 23 2024]
a(n) = A305238(n-9) for 10 <= n <= 99. - M. F. Hasler, Oct 16 2018

A115303 a(n) = n if n < 3, otherwise 3*a(floor(n/3)) + 2 - n mod 3.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

Self-inverse permutation of the natural numbers.
if n is written in ternary representation, then a(n) is the value after replacing all digits d (but not the leading one) with 2-d.
a(n+1) = a(n)-1 unless n = 3^k - 1 or 2*3^k-1 for some k. - Robert Israel, Feb 28 2023

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
       3*procname(floor(n/3))+2 - (n mod 3)
    end proc:
    a(1):= 1: a(2):= 2:
    map(a, [$1..100]); # Robert Israel, Feb 28 2023
  • Mathematica
    A115303[n_] := FromDigits[MapAt[2 - # &, IntegerDigits[n, 3], 2;;], 3];
    Array[A115303, 100] (* Paolo Xausa, May 20 2024 *)

Formula

a(n) = A115310(n+1,2).

A115304 a(n) = n if n < 4, otherwise 4*a(floor(n/4)) + 3 - n mod 4.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

Self-inverse permutation of the natural numbers.
If n is written in base-4 representation, then a(n) is the value after replacing all digits d (except for the leading one) by 3-d.

Crossrefs

Programs

Formula

a(n) = A115310(n+2,3).
a(n) = n XOR (4^A102572(n) - 1). - Alan Michael Gómez Calderón, Mar 27 2025
a(a(n)) = n. - A.H.M. Smeets, Apr 01 2025

A115305 a(n) = if n<5 then n else 5*a(floor(n/5)) + 4 - n mod 5.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

Self-inverse permutation of the natural numbers;
A115310(n+3,4) = a(n);
if n is written in base 5 representation, then a(n) is the value after replacing all digits d (but not the leading one) by 4-d.

Crossrefs

Programs

  • Mathematica
    Table[d = IntegerDigits[n, 5]; FromDigits[Prepend[4 - Rest@d, d[[1]]], 5], {n, 72}] (* Ivan Neretin, Apr 26 2017 *)

A115306 a(n) = if n<6 then n else 6*a(floor(n/6)) + 5 - n mod 6.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

Self-inverse permutation of the natural numbers;
if n is written in base 6 representation, then a(n) is the value after replacing all digits d (but not the leading one) by 5-d.

Crossrefs

Programs

  • Mathematica
    a[n_]:=If[n<6,n,6*a[Floor[n/6]]+5-Mod[n,6]];Table[a[n],{n,72}] (* James C. McMahon, Aug 11 2024 *)

Formula

a(n) = A115310(n+4, 5).

A115308 a(n) = if n<8 then n else 8*a(floor(n/8)) + 7 - n mod 8.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

Self-inverse permutation of the natural numbers;
A115310(n+6,7) = a(n);
if n is written in octal representation, then a(n) is the value after replacing all digits d (but not the leading one) by 7-d.

Crossrefs

Formula

a(n) = n XOR (8^floor(log_8(n)) - 1). - Alan Michael Gómez Calderón, Mar 27 2025

A115309 a(n) = if n<9 then n else 9*a(floor(n/9)) + 8 - n mod 9.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

Self-inverse permutation of the natural numbers;
A115310(n+7,8) = a(n);
if n is written in base 9 representation, then a(n) is the value after replacing all digits d (but not the leading one) by 8-d.

Crossrefs

A115310 Triangle read by rows, 0<=k<=n: T(n,k) = if n < 2*k then n-k+1 else (k+1)*T(k-1+floor((n-k+1)/(k+1)),k) + k - (n-k+1) mod (k+1).

Original entry on oeis.org

1, 3, 1, 2, 2, 1, 7, 5, 2, 1, 6, 4, 3, 2, 1, 5, 3, 7, 3, 2, 1, 4, 8, 6, 4, 3, 2, 1, 15, 7, 5, 9, 4, 3, 2, 1, 14, 6, 4, 8, 5, 4, 3, 2, 1, 13, 17, 11, 7, 11, 5, 4, 3, 2, 1, 12, 16, 10, 6, 10, 6, 5, 4, 3, 2, 1, 11, 15, 9, 5, 9, 13, 6, 5, 4, 3, 2, 1, 10, 14, 8, 14, 8, 12, 7, 6, 5, 4, 3, 2, 1, 9, 13, 15, 13, 7, 11, 15, 7, 6, 5, 4, 3, 2, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 20 2006

Keywords

Comments

The sequences a_k(n) = T(n,k) are self-inverse permutations of the natural numbers:
T(n,1) = A054429(n);
T(n,2) = A115303(n-1) for n>1;
T(n,3) = A115304(n-2) for n>2;
T(n,4) = A115305(n-3) for n>3;
T(n,5) = A115306(n-4) for n>4;
T(n,6) = A115307(n-5) for n>5;
T(n,7) = A115308(n-6) for n>6;
T(n,8) = A115309(n-7) for n>7;
T(n,9) = A106649(n-8) for n>8;
T(n,k) = n-k+1 for k > n/2, especially T(n,n)=1 and T(2*n-1,n)=n.

Examples

			Triangle begins:
  1;
  3, 1;
  2, 2, 1;
  7, 5, 2, 1;
  6, 4, 3, 2, 1;
  5, 3, 7, 3, 2, 1;
  4, 8, 6, 4, 3, 2, 1;
  ...
		

Crossrefs

Programs

  • Mathematica
    T[n_, k_] := T[n, k] = If[n < 2 k, n - k + 1, (k + 1)*T[k - 1 + Floor[(n - k + 1)/(k + 1)], k] + k - Mod[n - k + 1, k + 1]];
    Table[T[n, k], {n, 1, 14}, {k, 1, n}] // Flatten (* Jean-François Alcover, Oct 03 2021 *)
Showing 1-9 of 9 results.