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!)
A050074 a(n) = |a(n-1) - a(m)| for n >= 4, where m = 2^(p+1) + 2 - n and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = 1, a(2) = 2, and a(3) = 3. 0
1, 2, 3, 1, 0, 1, 2, 0, 1, 1, 1, 0, 0, 1, 2, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 2, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1, 2, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
MAPLE
a := proc(n) option remember;
`if`(n < 4, [1, 2, 3][n], abs(a(n - 1) - a(Bits:-Iff(n - 2$2) + 3 - n)))
end:
seq(a(n), n = 1..90); # Petros Hadjicostas, Nov 08 2019
PROG
(PARI) lista(nn) = {nn = max(nn, 3); my(va = vector(nn)); va[1] = 1; va[2] = 2; va[3] = 3; for(n=4, nn, va[n] = abs(va[n-1] - va[2 - n + 2*2^logint(n-2, 2)])); va; } \\ Petros Hadjicostas, May 15 2020
CROSSREFS
Sequence in context: A004566 A321896 A321897 * A346688 A278313 A006705
KEYWORD
nonn
AUTHOR
EXTENSIONS
Name edited by Petros Hadjicostas, Nov 08 2019
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.)