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!)
A190582 Generalized McCarthy function: a(n) = n - s if n > c; otherwise, a(n) = a(a(n+t)) with d = t - s > 0, with parameters t=15, s=9, c=21. 0

%I #18 Aug 15 2018 01:12:55

%S 16,17,18,13,14,15,16,17,18,13,14,15,16,17,18,13,14,15,16,17,18,13,14,

%T 15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,

%U 38,39,40

%N Generalized McCarthy function: a(n) = n - s if n > c; otherwise, a(n) = a(a(n+t)) with d = t - s > 0, with parameters t=15, s=9, c=21.

%C The parameters t=11, s=10, c=100 give the McCarthy 91-Function A103847.

%F The sequence begins with a(1) = d*floor((c+d-1)/d) + 1 - s;

%F if n <= c and c > d then a(n) = a(n-d);

%F if n <= c <= d then a(n) = a(1) + n - 1;

%F if n > c then a(n) = n - s.

%e For t=9, s=5, d=t-s=4, and

%e c=1: (0,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=2: (0, 1,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=3: (0, 1, 2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=4: (0, 1, 2, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=5: (4, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=6: (4, 5, 2, 3, 4, 5, 2, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=7: (4, 5, 6, 3, 4, 5, 6, 3, 4, 5, 6, 7, 8, 9, ...)

%e c=8: (4, 5, 6, 7, 4, 5, 6, 7, 4, 5, 6, 7, 8, 9, ...)

%e c=9: (8, 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8, 9, ...)

%p d=t-s:

%p a[1]:=d*(iquo(c+d-1,d))+1-s:

%p if (c <= d) then

%p for j from 2 to c do

%p a[j]:=a[1]+j-1:

%p end do:

%p end if:

%p if (c > d) then

%p k:=(c-1) mod d +1:

%p for j from 2 to k do

%p a[j]:=a[1]+j-1:

%p end do:

%p for j from (k+1) to d do

%p a[j]:=a[1]+j-d-1:

%p end do:

%p for j from (d+1) to c do

%p a[j]:=a[j-d]:

%p end do:

%p end if:

%p for n from (c+1) to 50 do

%p a[n]:=n-s:

%p end do:

%Y Cf. A103847 (McCarthy 91-function).

%K nonn

%O 1,1

%A _Paul Weisenhorn_, May 13 2011

%E Name corrected by _Paul Weisenhorn_, Aug 12 2018

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 25 10:51 EDT 2024. Contains 371967 sequences. (Running on oeis4.)