OFFSET
0,2
COMMENTS
A prime index of n is a number m such that prime(m) divides n. The multiset of prime indices of n is row n of A112798.
The weighted sum of a sequence (y_1,...,y_k) is Sum_{i=1..k} i*y_i.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..500
EXAMPLE
The terms together with their prime indices begin:
1: {}
2: {1}
3: {2}
5: {3}
7: {4}
11: {5}
13: {6}
17: {7}
19: {8}
25: {3,3}
29: {10}
35: {3,4}
49: {4,4}
55: {3,5}
77: {4,5}
The 5 numbers with weighted sum of prime indices 12, together with their prime indices:
20: {1,1,3}
27: {2,2,2}
33: {2,5}
37: {12}
49: {4,4}
Hence a(12) = 49.
MATHEMATICA
nn=10;
primeMS[n_]:=If[n==1, {}, Flatten[Cases[FactorInteger[n], {p_, k_}:>Table[PrimePi[p], {k}]]]];
ots[y_]:=Sum[i*y[[i]], {i, Length[y]}];
seq=Table[ots[primeMS[n]], {n, 1, 2^nn}];
Table[Position[seq, k][[-1, 1]], {k, 0, nn}]
PROG
(PARI)
a(n)={ my(recurse(r, k, m) = if(k==1, if(m>=r, prime(r)),
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));
if(n==0, 1, vecmax(vector((sqrtint(8*n+1)-1)\2, k, recurse(n, k, n))));
} \\ Andrew Howroyd, Jan 21 2023
CROSSREFS
The reverse version is A359683.
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jan 15 2023
EXTENSIONS
Terms a(21) and beyond from Andrew Howroyd, Jan 21 2023
STATUS
approved