%I #8 Oct 09 2019 16:28:38
%S 1,2,4,8,15,24,32,48,62,80,101,122,147,171,202,230,267,299,339,377,
%T 418,464,509,559,611,664,719,776,836,896,960,1024,1098,1167,1240,1315,
%U 1392,1471,1553,1642,1724,1816,1906,1999,2094,2190,2290,2392,2499,2599,2713,2818,2937,3048,3166,3288
%N The sequence whose indicator function is I in conjectured formula A300997(n) = 2*n - Sum_{k=1..n} I(k), as long as the conjecture holds.
%C A300997(n) is believed to be equal to 2*n - Sum_{k=1..n} I(k), where I is the indicator function of some other sequence -- let it be this sequence. This sequence is finite if the conjecture is false.
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Indicator_function">Indicator function</a>
%o (C)
%o #include <stdio.h>
%o #include <string.h>
%o #define N 10000
%o void e(int *t, int *s) {
%o int T[N], i = 0; memset(T, 0, sizeof(T));
%o while (i < *s) {
%o int f = t[i] / 2;
%o T[i] += f + (t[i] % 2);
%o T[++ i] += f;
%o }
%o if (T[*s] != 0) { *s += 1; }
%o for (i = 0; i < *s; i ++) { t[i] = T[i]; }
%o }
%o int f(int n) {
%o int t[N], s = 1, i = 0; t[0] = n;
%o while (s != n) { i ++; e(t, &s); }
%o return 2 * n - i;
%o }
%o int main() {
%o int n, last = 1, current;
%o for (n = 1; n <= N; n ++) {
%o current = f(n);
%o switch (current - last) {
%o case 0: break;
%o case 1: printf("%d, ", n); fflush(stdout); break;
%o default: fprintf(stderr, "CONJECTURE IS FALSE"); return;
%o }
%o last = current;
%o }
%o printf("\n");
%o }
%Y Cf. A300997.
%K nonn
%O 1,2
%A _Luc Rousseau_, Jun 16 2018
|