\\ A PARI-program to compute terms of A014652 quickly. This should work at least in GP/PARI CALCULATOR Versions 2.9.3 and 2.9.4 \\ To load the program in, say read("a014652.gp.txt") in PARI. \\ Based on David A. Corneth's PARI-program given at https://oeis.org/A066874/a066874.gp.txt \\ (But note that the routine customparts is different here!) \\ Antti Karttunen provided the routine primefactors_with1 \\ \\ To produce a b-file, say: \\ \\ allocatemem(2^30); \\ default(parisizemax,2^31); \\ for(n=1,10000,write("b014652.txt", n, " ", A014652(n))); \\ A014652(n) = (customparts(primefactors_with1(n), n-1)[n]); primefactors_with1(n) = vecsort(setunion([1],factor(n)[,1]~)); addhelp(customparts, "Vector of n+1 of number of partitions of 0 through n into parts of v. Assumes distinct elements in v.") customparts(v, n) = { my(res = vector(n+1)); res[1] = 1; for(i = 1, #v, for(j = v[i]+1, n+1, res[j] += res[j - v[i]] ) ); res } custompartsIterate(n) = { my(v = vector(n, i, 1), s = sum(i = 1, n, vpartsCopy[v[i]])); while(v != 0, j = 0; s = sum(i=1,#v,vpartsCopy[v[i]]); if(s < maxSum, mapisdefined(vInv, maxSum - s, &j); if(j >= v[#v], count++ ); v = nxtVl(v, #vpartsCopy); , v = nxtVs(v) ) ) } nxtVl(v, {u = oo}) = { if(v[#v] + 1 <= u, v[#v]++; v , nxtVs(v) ) } nxtVs(v) = { forstep(j = #v - 1, 1, -1, if(v[j] + 1 < v[#v], v[j]++; for(k = j + 1, #v, v[k] = v[j] ); return(v) ) ) ; return([0]) }