OFFSET
1,1
COMMENTS
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..500
EXAMPLE
The terms together with their prime indices begin:
4: {1,1}
9: {2,2}
25: {3,3}
49: {4,4}
121: {5,5}
169: {6,6}
289: {7,7}
361: {8,8}
529: {9,9}
841: {10,10}
MATHEMATICA
nn=10;
prix[n_]:=If[n==1, {}, Flatten[Cases[FactorInteger[n], {p_, k_}:>Table[PrimePi[p], {k}]]]];
wts[y_]:=Sum[(i-1)*y[[i]], {i, Length[y]}];
seq=Table[wts[prix[n]], {n, 2^nn}];
Table[Position[seq, k][[-1, 1]], {k, nn}]
PROG
(PARI) a(n)={ my(recurse(r, k, m) = if(k==1, if(m>=r, prime(r)^2),
my(z=0); for(j=1, min(m, (r-k*(k-1)/2)\k), z=max(z, self()(r-k*j, k-1, j)*prime(j))); z));
vecmax(vector((sqrtint(8*n+1)-1)\2, k, recurse(n, k, n)));
} \\ Andrew Howroyd, Jan 21 2023
CROSSREFS
A053632 counts compositions by zero-based weighted sum.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jan 16 2023
EXTENSIONS
Terms a(21) and beyond from Andrew Howroyd, Jan 21 2023
STATUS
approved