g | x | w | all
Bytes Lang Time Link
067Wolfram Language Mathematica241028T143121Z138 Aspe

Wolfram Language (Mathematica), 67 bytes

Try it online!

f@1=1;f@n_:=1+f[n-f@f[n-1]]
g@n_:=Sum[f[i]~Mod~998244353,{i,1,n}]^2