

A281130


a(n+1) = a(na(n)) if a(n1) < 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(s1) = a(s2) = (s+m)/2 and from there it follows that a(s2(s+m)/2) = (s+m)/2, but s2(s+m)/2 < (s+m)/2 which is a contradiction to the first statement.  Rok Cestnik, Aug 29 2017
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(3a(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[i1] < a[i]) a[i+1] = a[ia[i]];
else a[i+1] = 2*a[i];
printf("%d %d\n", i+1, a[i+1]);
}
return 0;
}


CROSSREFS



KEYWORD

nonn


AUTHOR



STATUS

approved



