A281131 First appearance of 2^n in A281130.
1, 3, 7, 13, 23, 41, 98, 223, 437, 699, 1213, 2624, 4674, 11163, 21300, 40858, 73977, 148591, 297394, 567076, 1100738, 2243474, 4340628, 8726122, 17397270, 34701556, 68372147, 136254352, 271069771, 546613630, 1088921640, 2163138108, 4334318825
Offset: 0
Examples
a(1) = 3 because A281130(3) = 2^1 and A281130(i) != 2^1 for i < 3. a(2) = 7 because A281130(7) = 2^2 and A281130(i) != 2^2 for i < 7.
Links
- Rok Cestnik, C program (utilizing hard drive memory)
Programs
-
C
#include
#include int main(void){ int N = 1000000000; int *a = (int*)malloc((N+1)*sizeof(int)); int max = 1; int maxindex = 1; 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]; if(a[i+1] > max){ max = a[i+1]; printf("%d %d\n", maxindex, i+1); maxindex++; } } return 0; } -
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; Function[w, Function[e, First /@ Lookup[w, 2^e]]@ Range[0, Log2@ Max@ Keys@ w]]@ PositionIndex@ Array[a, 10^7] (* Michael De Vlieger, Jan 21 2017, Version 10. *)
Extensions
a(31)-a(32) from Rok Cestnik, Aug 27 2017
Comments