This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A281130 #37 Sep 13 2017 03:33:09 %S A281130 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, %T A281130 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, %U A281130 16,4,8,32,4,8,8,16,8,16,16,32,16,32,4,8,16,16,32,8 %N 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. %C A281130 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 %C A281130 From _Robert G. Wilson v_, Jan 16 2017: (Start) %C A281130 a(n) = 2^k, k >= 0. %C A281130 a(n)=1 for n: 1, 2, 4; %C A281130 a(n)=2 for n: 3, 5, 6, 8, 10, 14; %C A281130 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; %C A281130 First occurrence of 2^k (A281131): 1, 3, 7, 13, 23, 41, 98, 223, 437, 699, 1213, 2624, 4674, 11163, 21300, 40858, 73977, etc.; %C A281130 Last occurrence of 2^k: 4, 14, 240, 1314, 10565, 35893, 62417, 638149, 2030926, etc.; %C A281130 Number of occurrences of 2^k: 3, 6, 27, 77, 167, 330, 706, 1756, 3811, etc. %C A281130 (End) %H A281130 Rok Cestnik, <a href="/A281130/b281130.txt">Table of n, a(n) for n = 1..10000</a> %H A281130 Rok Cestnik, <a href="/A281130/a281130.pdf">Self-referencing visualization</a> %e A281130 a(3) = 2*a(2) = 2 because a(1) !< a(2). %e A281130 a(4) = a(3-a(3)) = 1 because a(2) < a(3). %t A281130 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] %o A281130 (C) %o A281130 #include<stdio.h> %o A281130 #include<stdlib.h> %o A281130 int main(void){ %o A281130 int N = 1000; %o A281130 int *a = (int*)malloc((N+1)*sizeof(int)); %o A281130 printf("1 1\n2 1\n"); %o A281130 a[1] = 1; %o A281130 a[2] = 1; %o A281130 for(int i = 2; i < N; ++i){ %o A281130 if(a[i-1] < a[i]) a[i+1] = a[i-a[i]]; %o A281130 else a[i+1] = 2*a[i]; %o A281130 printf("%d %d\n", i+1, a[i+1]); %o A281130 } %o A281130 return 0; %o A281130 } %Y A281130 Cf. A281131, A291598. %K A281130 nonn %O A281130 1,3 %A A281130 _Rok Cestnik_, Jan 15 2017