OFFSET
1,2
COMMENTS
Inverse permutation of A183079, when seen as a flattened sequence.
LINKS
Reinhard Zumkeller (first 250 terms) & Antti Karttunen, Table of n, a(n) for n = 1..10440
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
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 *)
PROG
(Haskell)
import Data.List (elemIndex)
import Data.Maybe (fromJust)
a220347 = (+ 1) . fromJust . (`elemIndex` a183079_list)
(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
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Dec 12 2012
EXTENSIONS
Old name moved to comments by Antti Karttunen, May 18 2015
STATUS
approved