Karim Belabas on Mon, 01 Jan 2024 15:15:01 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: gp_oeis_search (Search integer sequence specified by short PARI/GP script on oeis.org)
|
- To: hermann@stamm-wilbrandt.de
- Subject: Re: gp_oeis_search (Search integer sequence specified by short PARI/GP script on oeis.org)
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Mon, 1 Jan 2024 15:14:55 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1704118497; c=relaxed/relaxed; bh=a5epuYhNeFtCS2PR2f09BkDKRdckEUtwZM8mhT5cuKc=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=mW24mdgBYuRK8x/+7L4JfmbTAqvIUXaXSApg/av6oqdPsEygPtAfkYFR/v598pc/6MCmBEZ+nJPwRB7Z96F4z9xApZn7VSI0Guiai5J40FNIHRPfxJhMKIqIwiWoqUEIf8UppQGYB73nmYBn4W5/xBbNH8yn8H1Fr8O9B6oYKvf/h28FdYN+I/BQ24PatZi8137wXbJnz6gY2Nw16cm4NSfTTpw62Kj5nIFI91jgHZ4gMs/TKOPWFAJz+iFC6DX8WkJYWIGBm4TE8kzNpT9co/HP5adKFDX2mda0hEKbRQ0nHclysyXHCuiOQWg/r53eycv8Vh/5Cg8OPf0SXnwxCK1/9WwkmwY6pTXrTuLrYlQNFrXAbeFKupCQHUiu/wma3u5TICgMFj+JaxY0k6YBg4YT2d7ldby83jpUfZ0QVdHrP6MnPpMycs9XRb2aLBqg5InUXAKBMGaomXu5ZtDn2+Yovii4PQMQ5WyuX6Xtz80vNqWb5yZRc+H9xIGYk+a9JM7oShwcpMw7ZcVB7i2veEQtAckzQalf6zg/LrucQqMZot2z9KjROVjRFwIF1EVcdzhzGGG60MftOd8keChKt5YbsShyZbr/XNtEaUWMbeNOFYOYl+2EI88c9sBHFeKGgvyG/CqFBfRKzbwf3dQ8/ECsiY7+9C8kOUSITXDt5Vo=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1704118497; cv=none; b=0z3y4hyoaFdn6AXuTrSjEJKJFRio5hZ4+k9wETWpIfLWXgyf4JRLB5EhFEblV5enFRKukmdp7q31nkDIONwuW4uNhxlD0Zqdb7sqJVXyloMzSk4TRJrzmOKSdabFW8gzFwJ8cZjhyul2iPMwnKZB6rXUPTSMO+I2Gz6ycZaqvfhR7aT4vZ3ssyYxbxlV7jhYiFw+yDWx3CMLAskYGpbjc9IOeYwvZzU4chNZmu9L6QDamg9uPe+AiZQfaKA35i07VPlqcdy4H/rWwnOSi54jw283f1Fpl9TfGlroUQzVPgCydbRgGcB7o+yk79gO5jp36h1GdoYr4rFULd7zxIBR6+0X+YcXHYTZH1MMLSHW7oChP75w2kH2hO8ypgiEGvxukQkcscJFXIIqKWhidWwDmALUjkuEb0sgLQxDxbezJnbIOGHivq2SjCQ2CgEIKagkHixoBmZFrWM0kyKfLwXHdXSZ4GY2UuVI7X45pDzrvCNYXJxpTVg8dXNJXAHwrI5fIFJJuUm23sy/njmoQ3TuyW/cq/9QI8QECdz913wfaN8DntGxg4riNgiVyNtOFSWsf/JLk3p58JjGCAd5ZhZH1ZoVmuqsKYusbmsEjzU7r+4l+cSnxuGZW7bg13by+I4SYQVTUCYoQlOqLYOuXHhvdaHN56nmDMq1uRxAY7RBohs=
- Authentication-results: smail; arc=none
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Mon, 01 Jan 2024 15:15:02 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1704118497; bh=a5epuYhNeFtCS2PR2f09BkDKRdckEUtwZM8mhT5cuKc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LR213FNIgpEi9fLAPnTFJUZQdP73j7i8X/LHoydmp31NTAtlGQsU/nyrNhcuARw+1 iCl0wvHHC6web5kcFUwNOLlFRCMYo20Zg8PzxPUXS+7tn12Lptpz59KkrMC2ij5RIA bYzzxqYSRzL+7IVAWcTozVycT8H+zD2W+ulQ2Ctcn/x1bC2+lcyqvZC8kfKbuR2yvt cX7pdoLR2J90k5oQpaZR5lxu0Y35RiEbB+4mC4GBA4BPq9lX0rdpSZfOMN98QiRdRh BpL07thjZDGXTyWIwN78Vlp04r5HP2X8F44eSeTMdsJWvAwY/Ey5LUgf5ZR9kupXAe 2jBMXMNCIq/l7PR5KwCkVDYnIozCHU/y2vY1pncvIGyjYsT0dS4jwRrrWenhsGw6zx gQyxMLmO0hIDvjSVVi+HDYegpFxedhVOoreaFni/NN4Yzm//GDsSoDx/eZL3Tr3Cx0 wDLral4uZXBt+vfRbkm0LlzEKa3NJuUhZZ3jnNCUER12U9QmUWgcy0IMPQcQJGCxlW KZ+z7XxQj+NaCwFXVLef8MfBFJFMOB/YfGDdYhFLPdPBrtxSHbV2jrBRyObmMgGm8f BANi9FXlXFdpFHbDQdtJ2l9LWXhJsgiP5a6lhc3tYnqtcujCZ1ncjpdSfl1BrqcIj2 EiKMkqJyIjfScyUScsksHd6s=
- In-reply-to: <c993f70d496bf8608461d8c78505c945@stamm-wilbrandt.de>
- Mail-followup-to: hermann@stamm-wilbrandt.de, pari-users@pari.math.u-bordeaux.fr
- References: <c993f70d496bf8608461d8c78505c945@stamm-wilbrandt.de>
Dear Hermann,
Another interesting option is to do it all from gp:
oeis(v)=
{ my(s = ""); for (i=1, #v, s = concat(s, Str(v[i]",")));
extern(Str("$BROWSER https://oeis.org/search?q=", s))
}
v = vector(40, i, qfbclassno(-4*i)); /* some sequence of interest */
oeis(v);
I happen to have a BROWSER environment variable, but you could of course
replace $BROWSER by a hardcoded path to your favourite browser.
The above used all known terms; OEIS recommends using about 6 terms for
searches, omitting the first term in the sequence. This is easily done as
oeis(v[2..7])
which doesn't quite work in our example: 2004 matches ... But
oeis(v[2..14])
does produce a single match (as well as oeis(v[20..26]), etc.).
Cheers,
K.B.
P.S. My browser is firefox, always opened in a specific virtual desktop; in my
setting, the oeis() command opens a new tab in the existing browser window
and I can quickly switch desktops to check the result and go back to my
gp session (using keyboard shortcuts).
* hermann@stamm-wilbrandt.de [2024-01-01 09:58]:
> Often I search for integer sequences on the on-line encyclopedia for integer
> sequences.
> I create a short script that prints the sequence I am interested, separated
> by commas.
> Then I copy that sequence into oeis.org search field to find the sequence.
>
> Lately I always create the sequences with PARI/GP scripts, and they are
> typically short.
> So I created script gp_oeis_search to automate this process:
> https://gist.github.com/Hermann-SW/3112d25ede6052df738d8d96651f6d5d
>
> Yesterday I was interested in the -4*n classnumber sequence and did:
>
> $ gp_oeis_search 'for(i=1,40,print1(qfbclassno(-4*i),","))'
>
> That opened this URL in the browser (works without commas being percent
> encoded in URL):
>
> https://oeis.org/search?q=1,1,1,1,2,2,1,2,2,2,3,2,2,4,2,2,4,2,3,4,4,2,3,4,2,6,3,2,6,4,3,4,4,4,6,4,2,6,4,4,
>
>
> I work with PARI/GP on my Android smartphone under termux.
> And wanted to be able to use above script under termux as well.
> After installing termux-x11 that was possible, details here (gist comment
> shows screenshot as well):
>
> https://gist.github.com/Hermann-SW/3112d25ede6052df738d8d96651f6d5d?permalink_comment_id=4813538#gistcomment-4813538
>
>
> Regards,
>
> Hermann.
>
K.B.
--
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/