[seqfan] Re: Numbers that are the sum of x nonzero y-th powers

M. F. Hasler oeis at hasler.fr
Tue Aug 4 09:32:16 CEST 2020

On Tue, Aug 4, 2020 at 5:13 AM David Corneth <davidacorneth at gmail.com>

> To make xrefs, in any format desired probably, I'll list the sequences in a
> (PARI) vector format in order of appearance in OEIS (including 3386 now and
> 3325 fixed) here:  [[404, 2, 2], [3325, 2, 3], (...)

nice database !
The order "first by # of terms, then by power" leads to contiguous ranges
which can be abbreviated with " - " or better "..",
but since the powers are only m = 2 .. 11 while  number of terms are k =
the former will more easily go in one row without line break. Specifically,
a table with 10 columns will have width = 10*(7+1) = 80 characters if the
A-numbers are separated with just a space (which was the format used in the
old index, although using ", " is nicer).

xrefline(v) = {
> res = "Cf. ";  (...)

This seems to be for use in the sequences. I'd suggest to give the full
list only in the index, a
nd  just some "entry points" here (xref sections in the main OEIS):
For example, in the sequence for (k,m) one could give
 the range of the (other) sequences with the same k,
 and the list of the other sequences with the same m.
This reduces the size from "10 x 11" to 2 + 10, and still includes all info
at one glance and allows quick and efficient "navigation".

> res = concat([res, Anumber(v[i][1]), " (", v[i][2], ", ", v[i][3], "), "]);

Instead of concat(), the dedicated functions for strings are Str() and/or
e.g., res=Str(res,strprintf(", A%06d (%d, %d)", v[i][1] , v[i][2] , v[i][3]

However, concat() is useful to avoid multiple consecutive string operations
and do it all in one step, viz:

fmt(r)=strprintf("%s A%06d (%d, %d)", if(r[1]>404,",","Cf."),r[1],r[2],r[3])
ref=concat([ fmr(r)  | r <- v ])

/* or amend "ref" to select from v[]  the A-numbers with same k or m: */
ref(k,m)=concat([ fmr(r)  | r <- v, (r[2]==k)-(r[3]==m) ])

Anumber(n) = {res = "A"; for(i = #digits(n) + 1, 6, res = concat(res, 0););
> return(concat(res, n))}

as seen above, that's just printf("A%06d", n), so a function isn't really

- Maximilian

More information about the SeqFan mailing list