A365493
a(n) is the smallest number which can be represented as the sum of n n-almost primes in exactly n ways, or -1 if no such number exists.
Original entry on oeis.org
2, 18, 44, 112, 418, 776, 1408, 3072, 7040, 14848, 53056, 77312, 147456, 315392, 988160, 5310464, 3194880, 6225920, 12845056, 46252032, 76873728, 117440512, 258998272, 1072824320, 1111490560, 3379560448, 5192548352, 9261023232, 24243077120, 41204842496, 81067507712
Offset: 1
For n = 2: 18 = 2*2 + 2*7 = 3*3 + 3*3.
A384842
a(n) is the n-th number which can be represented as the sum of n distinct n-almost primes in exactly n ways, or -1 if fewer than n such numbers exist.
Original entry on oeis.org
2, 24, 75, 211, 522, 1332, 3588, 8900, 20552, 48304, 118768, 256864, 558272, 1564608, 2863360
Offset: 1
For n = 2, the first number that is the sum of two distinct semiprimes in exactly two ways is A365494(2) = 19, and the second is a(2) = 24 = 9 + 15 = 10 + 14.
-
f:= proc(n) uses priqueue; local pq, S, t, x, y, k, i, p, v, R;
initialize(pq);
insert([-2^n, 2$n], pq);
S[0]:= 1:
for i from 1 to n do S[i]:= 0 od:
do
t:= extract(pq);
x:= -t[1];
for i from n to 1 by -1 do
S[i]:= expand(S[i] + S[i-1] * y^x);
od;
if type(S[n], `+`) then
R:= select(t -> degree(t, y) < x and eval(t, y=1) = n, convert(S[n], list));
if nops(R) >= n then R:= sort(map(t -> degree(t,y), R)); return R[n] fi;
fi;
p:= nextprime(t[-1]);
for i from n+1 to 2 by -1 while t[i] = t[-1] do
v:= x*(p/t[-1])^(n+2-i);
insert([-v, op(t[2..i-1]), p$(n+2-i)], pq)
od;
od;
end proc:
map(f, [$1..15]);
Showing 1-2 of 2 results.