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!)
A281130 a(n+1) = a(n-a(n)) if a(n-1) < a(n), otherwise a(n+1) = 2*a(n); a(1) = a(2) = 1. 8
1, 1, 2, 1, 2, 2, 4, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8, 4, 8, 8, 16, 4, 8, 8, 16, 4, 8, 8, 16, 4, 8, 8, 16, 8, 16, 8, 16, 16, 32, 4, 8, 16, 4, 8, 8, 16, 4, 8, 4, 8, 16, 16, 32, 16, 32, 8, 16, 8, 16, 4, 8, 32, 4, 8, 8, 16, 8, 16, 16, 32, 16, 32, 4, 8, 16, 16, 32, 8 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
The sequence is well defined, namely a(n) < n (with the exception of a(1)). Proof: Suppose a(s) = s+m, with m >= 0, is the first occurrence of a(n) >= n. It follows that a(s-1) = a(s-2) = (s+m)/2 and from there it follows that a(s-2-(s+m)/2) = (s+m)/2, but s-2-(s+m)/2 < (s+m)/2 which is a contradiction to the first statement. - Rok Cestnik, Aug 29 2017
From Robert G. Wilson v, Jan 16 2017: (Start)
a(n) = 2^k, k >= 0.
a(n)=1 for n: 1, 2, 4;
a(n)=2 for n: 3, 5, 6, 8, 10, 14;
a(n)=4 for n: 7, 9, 11, 12, 15, 16, 18, 20, 24, 28, 32, 42, 45, 49, 51, 62, 65, 75, 82, 84, 101, 108, 110, 118, 127, 175, 240;
First occurrence of 2^k (A281131): 1, 3, 7, 13, 23, 41, 98, 223, 437, 699, 1213, 2624, 4674, 11163, 21300, 40858, 73977, etc.;
Last occurrence of 2^k: 4, 14, 240, 1314, 10565, 35893, 62417, 638149, 2030926, etc.;
Number of occurrences of 2^k: 3, 6, 27, 77, 167, 330, 706, 1756, 3811, etc.
(End)
LINKS
EXAMPLE
a(3) = 2*a(2) = 2 because a(1) !< a(2).
a(4) = a(3-a(3)) = 1 because a(2) < a(3).
MATHEMATICA
a[n_] := a[n] = If[a[n -2] < a[n -1], a[n -1 -a[n -1]], 2 a[n -1]]; a[1] = a[2] = 1; Array[a, 100]
PROG
(C)
#include<stdio.h>
#include<stdlib.h>
int main(void){
int N = 1000;
int *a = (int*)malloc((N+1)*sizeof(int));
printf("1 1\n2 1\n");
a[1] = 1;
a[2] = 1;
for(int i = 2; i < N; ++i){
if(a[i-1] < a[i]) a[i+1] = a[i-a[i]];
else a[i+1] = 2*a[i];
printf("%d %d\n", i+1, a[i+1]);
}
return 0;
}
CROSSREFS
Sequence in context: A139318 A205779 A205551 * A054541 A277891 A102722
KEYWORD
nonn
AUTHOR
Rok Cestnik, Jan 15 2017
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 23 03:30 EDT 2024. Contains 371906 sequences. (Running on oeis4.)