login
a(n) is the smallest positive integer such that there exists no positive integer k with 2k < n where a(n-2k)*a(n-k)=a(n).
1

%I #21 Apr 11 2021 07:07:04

%S 1,1,2,1,1,2,3,3,2,1,1,2,1,1,2,3,3,2,4,4,2,4,4,2,3,3,2,1,1,2,1,1,2,3,

%T 3,2,1,1,2,1,1,2,3,3,2,4,4,2,4,4,2,3,3,2,5,5,2,5,5,2,3,3,2,5,5,2,5,5,

%U 2,3,3,2,4,4,2,4,4,2,3,3

%N a(n) is the smallest positive integer such that there exists no positive integer k with 2k < n where a(n-2k)*a(n-k)=a(n).

%H Daniel von Savoye, <a href="/A343026/b343026.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1) = 1, a(2) = 1, but a(3) != 1 because if a(3) = 1, a(1)*a(2)=a(3). Therefore, a(3) = 2, and so on.

%o (Python)

%o #generates first x digits of sequence

%o def seq(x):

%o a = []

%o excluded = {}

%o for n in range(x):

%o if n == 0 or n == 1:

%o a.append(1)

%o else:

%o m = 1

%o while m in excluded[n]:

%o m += 1

%o a.append(m)

%o for i in range(n):

%o j = 2 * n - i

%o k = a[i] * a[n]

%o if j in excluded and k not in excluded[j]:

%o excluded[j].append(k)

%o else:

%o excluded[j] = [k]

%o return a

%o (PARI) isok(v, n, j) = {for (k=1, n, if (n-2*k<=0, break); if (v[n-2*k]*v[n-k] == j, return (0));); return (1);}

%o nextv(v, n) = {my(j=1); while (!isok(v, n, j), j++); j;}

%o lista(nn) = {my(v = vector(nn)); v[1] = 1; for (n=2, nn, v[n] = nextv(v, n);); v;} \\ _Michel Marcus_, Apr 04 2021

%K nonn

%O 1,3

%A _Daniel von Savoye_, Apr 02 2021