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

A220347 Permutation of natural numbers: a(1) = 1, a(triangular(n)) = (2*a(n))-1, a(nontriangular(n)) = 2*n, where triangular = A000217, nontriangular = A014132.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 8, 12, 10, 7, 16, 24, 20, 14, 11, 32, 48, 40, 28, 22, 9, 64, 96, 80, 56, 44, 18, 15, 128, 192, 160, 112, 88, 36, 30, 23, 256, 384, 320, 224, 176, 72, 60, 46, 19, 512, 768, 640, 448, 352, 144, 120, 92, 38, 13, 1024, 1536, 1280, 896, 704, 288
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 12 2012

Keywords

Comments

Inverse permutation of A183079, when seen as a flattened sequence.

Crossrefs

Inverse: A183079.
Cf. also a similar permutation A257797 from which this differs for the first time at n=15, where a(15) = 11, while A257797(15) = 9.

Programs

  • Haskell
    import Data.List (elemIndex)
    import Data.Maybe (fromJust)
    a220347 =  (+ 1) . fromJust . (`elemIndex` a183079_list)
    
  • Mathematica
    a[n_] := a[n] = With[{r = (-1 + Sqrt[8n + 1])/2}, Which[n <= 1, n, IntegerQ[r], 2 a[Floor[Sqrt[2n] + 1/2]] - 1, True, 2 a[n - Floor[r]]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Dec 05 2021 *)
  • Scheme
    ;; With memoizing definec-macro.
    (definec (A220347 n) (cond ((<= n 1) n) ((zero? (A010054 n)) (* 2 (A220347 (A083920 n)))) (else (+ -1 (* 2 (A220347 (A002024 n)))))))
    ;; Antti Karttunen, May 18 2015

Formula

a(1) = 1; for n > 1: if A010054(n) = 1 [i.e., if n is triangular], then a(n) = (2*a(A002024(n)))-1, otherwise a(n) = 2*a(A083920(n)). - Antti Karttunen, May 18 2015

Extensions

Old name moved to comments by Antti Karttunen, May 18 2015

A257798 Permutation of natural numbers: a(1) = 1; a(2n) = nontriangular(a(n)), a(2n+1) = triangular(1+a(n)), where triangular = A000217, nontriangular = A014132.

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 10, 7, 15, 9, 28, 8, 21, 14, 66, 11, 36, 20, 136, 13, 55, 35, 435, 12, 45, 27, 253, 19, 120, 77, 2278, 16, 78, 44, 703, 26, 231, 152, 9453, 18, 105, 65, 1596, 43, 666, 464, 95266, 17, 91, 54, 1081, 34, 406, 275, 32385, 25, 210, 135, 7381, 89, 3081, 2345, 2598060, 22, 153, 90, 3160, 53, 1035, 740, 248160, 33
Offset: 1

Views

Author

Antti Karttunen, May 18 2015

Keywords

Comments

This sequence can be represented as a binary tree. Each left hand child is produced as A014132(n) and each right hand child as A000217(1+n), when a parent contains n >= 1:
1
................../ \..................
2 3
4......../ \........6 5......../ \.......10
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
7 15 9 28 8 21 14 66
11 36 20 136 13 55 35 435 12 45 27 253 19 120 77 2278
etc.

Crossrefs

Inverse: A257797.
Cf. also permutation A183079.

Formula

a(1)=1; after which: a(2n) = A014132(a(n)), a(2n+1) = A000217(a(n)+1).
Showing 1-2 of 2 results.