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!)
A352840 a(1) = 0; a(2) = 1; thereafter a(n) = a(n-1)/2 if a(n-1) is even, otherwise a(n) = a(n-1) + a((n-1)-a(n-1)). 1
0, 1, 1, 2, 1, 3, 4, 2, 1, 3, 7, 9, 10, 5, 6, 3, 13, 15, 16, 8, 4, 2, 1, 3, 7, 22, 11, 14, 7, 9, 13, 28, 14, 7, 18, 9, 20, 10, 5, 12, 6, 3, 8, 4, 2, 1, 3, 7, 13, 22, 11, 23, 30, 15, 20, 10, 5, 28, 14, 7, 37, 40, 20, 10, 5, 12, 6, 3, 8, 4, 2, 1, 3, 7, 13, 53 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,4
LINKS
EXAMPLE
a(1)=0.
a(2)=1.
1 is odd, so a(3) = a(2) + a(2-a(2)) = a(2) + a(2-1) = a(2) + a(1) = 1 + 0 = 1.
1 is odd, so a(4) = a(3) + a(3-a(3)) = a(3) + a(3-1) = a(3) + a(2) = 1 + 1 = 2.
2 is even, so a(5) = a(4)/2 = 2/2 = 1.
Continuing, we get
n a(n)
- ----
1 0
2 1
3 1 + a(1) 1 + 0 = 1
4 1 + a(2) 1 + 1 = 2
5 a(4) / 2 2 / 2 = 1
6 1 + a(4) 1 + 2 = 3
7 3 + a(3) 3 + 1 = 4
8 a(7) / 2 4 / 2 = 2
9 a(8) / 2 2 / 2 = 1
10 1 + a(8) 1 + 2 = 3
11 3 + a(7) 3 + 4 = 7
12 7 + a(4) 7 + 2 = 9
PROG
(Python)
result = [0, 1]
iterations = 100
for i in range(1, iterations):
if result[i]%2 == 0:
result.append(result[i] // 2)
else:
result.append(result[i] + result[i - result[i]])
print(result, end='', sep=' ')
(MATLAB)
result = [0 1];
iterations = 100;
for i = 2:iterations
if mod(result(i), 2) == 0
result(i+1) = int32(result(i)/2);
else
result(i+1) = (result(i) + result(i - result(i)));
end
end
CROSSREFS
Cf. A350129.
Sequence in context: A229287 A286539 A004741 * A133923 A347296 A341231
KEYWORD
nonn,look,easy
AUTHOR
Gavin Lupo, Apr 05 2022
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 August 5 18:20 EDT 2024. Contains 374954 sequences. (Running on oeis4.)