login
A350559
Numerators 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 a(m)= f(n), then set f(n+1)=1. Start with f(1)=1 and f(2)=0. a(n) = numerator(f(n)).
1
1, 0, 1, 1, 1, 1, 3, 1, 1, 1, 1, 3, 1, 1, 2, 1, 1, 4, 1, 1, 4, 16, 1, 1, 1, 1, 8, 1, 1, 10, 1, 1, 4, 52, 1, 1, 13, 1, 1, 8, 1, 1, 4, 44, 1, 1, 11, 1, 1, 8, 88, 1, 1, 2, 80, 1, 1, 5, 1, 1, 4, 1, 1, 4, 88, 440, 1, 1, 1, 1, 45, 1, 1, 11, 1, 1, 4, 56, 1, 1, 6, 1
OFFSET
1,7
EXAMPLE
f(n) = [ 1, 0, 1, 1/2, 1, 1/2, 3/2, 1, 1/3, 1, …]
MATHEMATICA
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=Numerator/@Table[s[n], {n, 1, 100000}];
PROG
(Python)
from fractions import Fraction
from itertools import count, islice
def rfind(lst, item): # find item in list before last index
idx = len(lst) - 2
while lst[idx] != None and lst[idx] != item: idx -= 1
return idx
def agen(): # generator of terms
f = [None, Fraction(1, 1), Fraction(0, 1)]
yield from [1, 0]
for n in count(2):
m = rfind(f, f[n])
if m > 0: fp = Fraction(1, n-m) if f[n] == 1 else f[n] + f[m]*(n-m)
else: fp = Fraction(1, 1)
f.append(fp)
yield fp.numerator
print(list(islice(agen(), 82))) # Michael S. Branicky, Jan 16 2022
(PARI) findm(list, n) = {forstep (m=n-1, 1, -1, if (list[m] == list[n], return(m))); return(0); }
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); }
listnum(nn) = apply(numerator, listf(nn)); \\ Michel Marcus, Jan 17 2022
CROSSREFS
Cf. A350228, A350560 (denominators).
Sequence in context: A362302 A336839 A291568 * A365401 A212181 A256452
KEYWORD
nonn,frac
AUTHOR
Jasmine Miller, Jan 05 2022
STATUS
approved