OFFSET
1,2
COMMENTS
Conjecture: a(n) - 1 is prime if and only if a(n) = n + 1. - Mikhail Kurkov, Mar 10 2022
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..10000
FORMULA
Conjecture: a(n) = A057064(n+1) - 1 for n > 0. - Mikhail Kurkov, Mar 10 2022
EXAMPLE
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.
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 *)
PROG
(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
(PARI) a(n) = { my (p=0); forstep (d=n, 1, -1, if (p%d==0, p+=d)); p } \\ Rémy Sigrist, Aug 25 2020
CROSSREFS
KEYWORD
nonn,nice,easy
AUTHOR
Clark Kimberling, Jul 29 2000
EXTENSIONS
More terms from David Wasserman, Apr 22 2002
STATUS
approved