login
This site is supported by donations 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

Alois P. Heinz, Table of n, a(n) for n = 1..5000

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

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: A113892 A078225 A244247 * A163372 A066437 A153270

Adjacent sequences:  A211343 A211344 A211345 * A211347 A211348 A211349

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 | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 13 01:32 EST 2018. Contains 317118 sequences. (Running on oeis4.)