upto(n) = {
	my(v = vector(2*precprime(n), i, List()), u = 2*precprime(n), w = vector(n, i, oo), res = []);
	listput(v[1], 1);
	for(i = 2, n, 
		s = i + sopfr(i);
		listput(v[s], i);
		
	);
	for(i = 2, u,
		s = i - sopfr(i);
		if(1 <= s && s <= n,
			w[s] = min(w[s], i);
		)
	);
	for(i = 1, n, 
		c = #v[i];
		if(c > #res, 
			res = concat(res, vector(c - #res, i, oo));
		);
		if(c > 0,
			ind = w[i];
			if(ind < oo,
				res[c] = min(res[c], w[i]);
			)
		)
	);
	\\until here we have A370091 with maybe gaps. Now make A369351 out of it.
	for(i = 1, #res, for(j = i+1, #res, res[i] = min(res[i],res[j])));
	res
}

sopfr(n) = {
	my(f = factor(n));
	sum(i = 1, #f~, f[i,1]*f[i,2]);
}