A057032 Let P(n) of a sequence s(1), s(2), s(3), ... be obtained by leaving s(1), ..., s(n-1) fixed and forward-cyclically permuting every n consecutive terms thereafter; apply P(2) to 1, 2, 3, ... to get PS(2), then apply P(3) to PS(2) to get PS(3), then apply P(4) to PS(3), etc. The limit of PS(n) as n -> oo is this sequence.
1, 3, 4, 7, 6, 10, 8, 16, 15, 21, 12, 22, 14, 27, 28, 36, 18, 33, 20, 43, 35, 39, 24, 53, 34, 45, 46, 50, 30, 66, 32, 78, 52, 57, 55, 81, 38, 63, 59, 88, 42, 86, 44, 96, 87, 75, 48, 119, 64, 111, 76, 101, 54, 103, 79, 144, 83, 93, 60, 141, 62, 99, 113, 173, 91, 136, 68, 139
Offset: 1
Examples
PS(2) begins with 1, 3, 2, 5, 4, 7, 6; PS(3) begins with 1, 3, 4, 2, 5, 9, 7; PS(4) begins with 1, 3, 4, 7, 2, 5, 9.
Links
- Rémy Sigrist, Table of n, a(n) for n = 1..10000
Programs
-
MATLAB
function m = A057032(i) m = PS(i, i); function m = PS(i, n) if i == 1 m = n; elseif n < i m = PS(i - 1, n); else if mod(n, i) == 0 m = PS(i - 1, n + i - 1); else m = PS(i - 1, n - 1); end end
-
Mathematica
PS[i_, n_] := If[i == 1, n, If[n < i, PS[i-1, n], If[Mod[n, i] == 0, PS[i-1, n+i-1], PS[i-1, n-1]]]]; a[n_] := PS[n, n]; Table[a[n], {n, 1, 68}] (* Jean-François Alcover, Oct 20 2011, after MATLAB *)
-
PARI
a(n) = { my (p=0); forstep (d=n, 1, -1, if (p%d==0, p+=d)); p } \\ Rémy Sigrist, Aug 25 2020
Formula
Conjecture: a(n) = A057064(n+1) - 1 for n > 0. - Mikhail Kurkov, Mar 10 2022
Extensions
More terms from David Wasserman, Apr 22 2002
Comments