%I #34 Feb 11 2022 17:06:36
%S 1,1,1,2,1,2,2,1,3,1,2,1,1,3,1,1,3,3,1,3,3,3,1,4,1,2,1,1,3,3,1,3,3,3,
%T 1,4,4,1,3,3,1,3,3,3,1,4,4,1,3,3,3,1,4,1,1,1,4,4,1,3,1,1,3,3,3,1,1,5,
%U 1,2,2,1,3,3,1,3,3,3,1,4,1,1,3,3,3,1,4
%N Denominators of the fractional, multiplicative Van Eck Sequence f(n): for n >= 2, if there exists an m < n such that f(m) = f(n), take the largest such m. If f(n)=1, set f(n+1) = 1/(n-m); otherwise, if f(n) != 1, set f(n+1) = f(n)+f(m)*(n-m). If no m exists such that f(m) = f(n), then set f(n+1)=1. Start with f(1)=1 and f(2)=0. a(n) = denominator(f(n)).
%e f(n) = [ 1, 0, 1, 1/2, 1, 1/2, 3/2, 1, ... ]
%t f[1]=1; f[n_]:=0; f2[n_]:=0; a[n_]:=Block[{q=f2[x]}, If[q!=0, If[x==1,s[n]=1/(n-1-q),s[n]=((n-1-q)*(x))+x], s[n]=1]]; s[1]=1; s[2]=0; x=0; Do[x=a[n]; f2[x]=f[x]; f[x]=n, {n, 3, 100000}]; data=Denominator/@Table[s[n], {n, 1, 100000}];
%o (Python)
%o from fractions import Fraction
%o from itertools import count, islice
%o def rfind(lst, item): # find item in list before last index
%o idx = len(lst) - 2
%o while lst[idx] != None and lst[idx] != item: idx -= 1
%o return idx
%o def agen(): # generator of terms
%o f = [None, Fraction(1, 1), Fraction(0, 1)]
%o yield from [1, 1]
%o for n in count(2):
%o m = rfind(f, f[n])
%o if m > 0: fp = Fraction(1, n-m) if f[n] == 1 else f[n] + f[m]*(n-m)
%o else: fp = Fraction(1, 1)
%o f.append(fp)
%o yield fp.denominator
%o print(list(islice(agen(), 87))) # _Michael S. Branicky_, Jan 16 2022
%o (PARI) findm(list, n) = {forstep (m=n-1, 1, -1, if (list[m] == list[n], return(m))); return(0);}
%o listf(nn) = {my(list = List([1, 0])); for (n=3, nn, my(m = findm(list, n-1)); if (m, if (list[m] == 1, listput(list, 1/(n-1-m)), listput(list, list[n-1]*(n-m))), listput(list, 1););); Vec(list);}
%o listden(nn) = apply(denominator, listf(nn)); \\ _Michel Marcus_, Jan 17 2022
%Y Cf. A350228, A350559 (numerators).
%K nonn,frac
%O 1,4
%A _Jasmine Miller_, Jan 05 2022
|