login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A077140 a(1) = 1 and then add n to the previous term if n is coprime to the previous term else subtract n from the previous term. a(1) = 1 and a(n) = a(n-1) + n if G.C.D. (n,a(n-1) = 1 else a(n) = a(n-1) - n. 1
1, 3, 0, -4, 1, 7, 0, -8, 1, 11, 0, -12, 1, 15, 0, -16, 1, 19, 0, -20, 1, 23, 0, -24, 1, 27, 0, -28, 1, 31, 0, -32, 1, 35, 0, -36, 1, 39, 0, -40, 1, 43, 0, -44, 1, 47, 0, -48, 1, 51, 0, -52, 1, 55, 0 (list; graph; refs; listen; history; internal format)
OFFSET

1,2

COMMENTS

a[2k+1]=k+1 (mod 2), a[4k]=-4k, a[4k+2]=4k+3. Proof: If a[4k+3]=0 then a[4k+4]=-4k-4, a[4k+5]=1, a[4k+6]=1+4k+6 and again, a[4k+7]=0. - Ralf Stephan (ralf(AT)ark.in-berlin.de), Mar 18 2003

ABS(a(n)) = A003815(n). - Reinhard Zumkeller (reinhard.zumkeller(AT)gmail.com), Oct 09 2007

FORMULA

a(1) = 1 and a(n) = a(n-1) + n if G.C.D. (n, a(n-1) = 1 else a(n) = a(n-1) - n.

G.f.: x(x^2-2x-1)/((x^2+1)^2*(x-1)). - Ralf Stephan (ralf(AT)ark.in-berlin.de), Mar 18 2003

a(n) = ((n+1) mod 2)*n + (floor ((n+(n mod 2))/2) mod 2). - Tj Wrenn (tjwrenn(AT)cs.utexas.edu), Apr 07 2005

PROG

(PARI) v=vector(100):v[1]=1:for(k=2, 100, if(gcd(v[k-1], k)>1, v[k]=v[k-1]-k, v[k]=v[k-1]+k)):print(v)

CROSSREFS

Cf. A077141.

Sequence in context: A127375 A195084 A138376 * A003815 A131486 A127445

Adjacent sequences:  A077137 A077138 A077139 * A077141 A077142 A077143

KEYWORD

sign

AUTHOR

Amarnath Murthy (amarnath_murthy(AT)yahoo.com), Oct 30 2002

EXTENSIONS

More terms from Ralf Stephan (ralf(AT)ark.in-berlin.de), Mar 18 2003

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified February 15 21:56 EST 2012. Contains 205860 sequences.