login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 10
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
a(n) - 1 is prime if and only if a(n) = n + 1. - Mikhail Kurkov, Mar 10 2022 [verification needed]
LINKS
FORMULA
a(n) = A057064(n+1) - 1 for n > 0. - Mikhail Kurkov, Mar 10 2022 [verification needed]
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
(PARI) f(n, m)=my(s=Set(divisors(n))); s=setunion(s, Set(m)); s[setsearch(s, m)-1] \\ function for greatest divisor of n that is smaller than m
a(n) = if(n==1, 1, local(A=n, B=n, C); until(B==1, C=A; A=A+f(A, B); B=f(C, B)); A) \\ Mikhail Kurkov, Mar 10 2022 [verification needed]
CROSSREFS
Sequence in context: A175187 A332993 A126253 * A347529 A279388 A292288
KEYWORD
nonn,nice,easy,changed
AUTHOR
Clark Kimberling, Jul 29 2000
EXTENSIONS
More terms from David Wasserman, Apr 22 2002
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 02:46 EDT 2024. Contains 371917 sequences. (Running on oeis4.)