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!)
A211346 a(1) = 1; for n>1, let k = n-1 mod 4, then a(n) = operation k applied to the pair (a(n-1), n), where operation 1 is addition, operation 2 is difference (with reset to n if 0), operation 3 is multiplication and operation 0 is division with rounding. 2
1, 3, 3, 12, 2, 8, 1, 8, 1, 11, 11, 132, 10, 24, 9, 144, 8, 26, 7, 140, 7, 29, 6, 144, 6, 32, 5, 140, 5, 35, 4, 128, 4, 38, 3, 108, 3, 41, 2, 80, 2, 44, 1, 44, 1, 47, 47, 2256, 46, 96, 45, 2340, 44, 98, 43, 2408, 42, 100, 41, 2460, 40, 102, 39, 2496, 38, 104 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
After n=1, the values of n where a(n)=1 occur in pairs: 7, 9; 43, 45; 207, 209; 943, 945; 4255, 4257; 19159, 19161; 86227,86229; 388035, 388037; 1746171, 1746173; 7857783, 7857785; 35360035, 35360037; etc. [edited by Jon E. Schoenfield, Dec 11 2014]
This occurs only when avoiding zeros and negative numbers form operations and also with four operation sequences [+, -, *, /]; [-, *, /, +]; [*, /, +, -] & [/, +, -, *] among total 24 permutation ones.
LINKS
Kival Ngaokrajang, Scatter plot in log-log scale for n = 1..10^5, Centipede-like pattern.
FORMULA
a(1) = 1, for n >= 2; if (n - (4 * (round(n/4) - 1)) = 2, a(n) = a(n - 1) + n; if (n - (4 * (round(n/4) - 1)) = 3, a(n) = abs(a(n - 1) - n), if a(n - 1) = n, a(n) = n; if (n - (4 * (round(n/4) - 1)) = 4, a(n) = a(n-1) * n; if (n - (4 * (round(n/4) - 1)) = 5, a(n) = round(a(n - 1) / n).
EXAMPLE
a(2) = a(1) + 2 = 3
a(3) = a(2) - 3 = 0, a(3) = n = 3
a(4) = a(3) * 4 = 12
a(5) = a(4) / 5 = round(12/5) = 2
a(6) = a(5) + 6 = 8,...
MAPLE
a:= proc(n) option remember; `if`(n<2, n,
[(x, y)->round(x/y), (x, y)->x+y,
(x, y)->`if`(x-y=0, y, abs(x-y)), (x, y)->x*y]
[1+irem(n-1, 4)](a(n-1), n))
end:
seq(a(n), n=1..100); # Alois P. Heinz, Feb 17 2013
MATHEMATICA
a[n_] := a[n] = If[n==1, 1, With[{k = Mod[n, 4]}, Switch[k, 0, a[n-1] n, 1, Round[a[n-1]/n], 2, a[n-1]+n, 3, If[a[n-1]==n, n, Abs[a[n-1]-n]]]]];
Array[a, 100] (* Jean-François Alcover, Mar 15 2021 *)
PROG
(Small Basic)
a[1]=1
For n=2 To 100
nn = math.Remainder(n, 4)
If nn = 2 Then ' operation +
a[n]=a[n-1]+n
Else
EndIf
If nn = 3 Then ' operation -
If a[n-1] = n Then
a[n]=n
Goto OUT
Else
EndIf
a[n]=Math.Abs(a[n-1]-n)
Else
EndIf
OUT:
If nn=0 Then ' operation *
a[n]=a[n-1]*n
Else
EndIf
If nn=1 Then ' operation /
a[n]=math.Round(a[n-1]/n)
Else
EndIf
EndFor
For j = 1 to 100
TextWindow.Write(j+" ")
TextWindow.Write(a[j])
TextWindow.WriteLine(" ")
EndFor
CROSSREFS
Sequence in context: A352582 A078225 A244247 * A163372 A349922 A066437
KEYWORD
nonn,look
AUTHOR
Kival Ngaokrajang, Feb 05 2013
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 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)