OFFSET
0,3
COMMENTS
Shares with permutation A237058 the property that all odd numbers occur in positions given by ludic numbers (A003309: 1, 2, 3, 5, 7, 11, 13, 17, ...), while the even numbers > 0 occur in positions given by nonludic numbers (A192607: 4, 6, 8, 9, 10, 12, 14, 15, 16, ...). However, instead of placing terms into those positions in monotone order this sequence recursively permutes the order of both subsets with the emerging permutation itself, so this is a kind of "deep" variant of A237058.
Alternatively, this can be viewed as yet another "entanglement permutation", where two pairs of complementary subsets of natural numbers are entangled with each other. In this case a complementary pair ludic/nonludic numbers (A003309/A192607) is entangled with a complementary pair odd/even numbers (A005408/A005843).
Because 2 is the only even ludic number, it implies that, apart from a(2)=3, odd numbers occur in odd positions only (along with many even numbers that also occur in odd positions).
LINKS
FORMULA
EXAMPLE
For n=2, with 2 being the second ludic number (= A003309(2)), the value is computed as 1+(2*a(2-1)) = 1+2*a(1) = 1+2 = 3, thus a(2)=3.
For n=3, with 3 being the third ludic number (= A003309(3)), the value is computed as 1+(2*a(3-1)) = 1+2*a(2) = 1+2*3 = 7, thus a(3)=7.
For n=4, with 4 being the first nonludic number (= A192607(1)), the value is computed as 2*a(1) = 2 = a(4).
For n=5, with 5 being the fourth ludic number (= A003309(4)), the value is computed as 1+(2*a(4-1)) = 1+2*a(3) = 1+2*7 = 15 = a(5).
For n=9, with 9 being the fourth nonludic number (= A192607(4)), the value is computed as 2*a(4) = 2*2 = 4 = a(9).
MATHEMATICA
nmax = 100;
T = Range[2, nmax+7];
L = {1};
While[Length[T] > 0, With[{k = First[T]},
AppendTo[L, k]; T = Drop[T, {1, -1, k}]]];
nonL = Complement[Range[Last[L]], L];
a[n_] := a[n] = Module[{k}, Which[
n < 2, n,
IntegerQ[k = FirstPosition[L, n][[1]]], 1 + 2 a[k-1],
IntegerQ[k = FirstPosition[nonL, n][[1]]], 2 a[k],
True , Print[" error: n = ", n]]];
PROG
(Haskell)
import Data.List (elemIndex); import Data.Maybe (fromJust)
a237427 = (+ 1) . fromJust . (`elemIndex` a237126_list)
(Scheme, with Antti Karttunen's IntSeq-library for memoizing definec-macro)
(definec (A237427 n) (cond ((< n 2) n) ((= 1 (A192490 n)) (+ 1 (* 2 (A237427 (- (A192512 n) 1))))) (else (* 2 (A237427 (A236863 n))))))
;; Antti Karttunen, Feb 07 2014
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Antti Karttunen and Reinhard Zumkeller, Feb 07 2014
STATUS
approved