[seqfan] Re: PARI/GP's random function, A260083

aleksisto aleksisto at gmail.com
Sun Sep 18 20:34:15 CEST 2016


                compiled: Oct 26 2015, gcc version 4.6.3 (GCC)
                            threading engine: single
                 (readline v6.2 enabled, extended help enabled)

                     Copyright (C) 2000-2015 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and 
comes
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?12 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
(21:32) gp > for(n=1,10,print(random))
326511477
1362174608
903267448
656347688
1853455872
693790135
1743812782
1381849689
1919384312
561030593
(21:32) gp >


----- Original Message ----- 
From: "Hugo Pfoertner" <yae9911 at gmail.com>
To: "Sequence Fanatics Discussion list" <seqfan at list.seqfan.eu>
Sent: Sunday, September 18, 2016 9:01 PM
Subject: [seqfan] PARI/GP's random function, A260083


> Seqfans,
>
> Felix Fröhlich's http://oeis.org/A260083 claims to be the numbers produced
> by PARI's random function when called without argument (i.e. using the
> default argument 2^31). Nothing is said about initialization, also not in
> the PARI documentation at
> http://pari.math.u-bordeaux.fr/dochtml/html/Conversions_and_similar_elementary_functions_or_commands.html
>
> When I try to reproduce the sequence by calling PARI/GP, I get
> GP/PARI CALCULATOR Version 2.5.3 (released)
>
> ? for(n=1,10,print(random))
> 1546275796
> 879788114
> 1745191708
> 771966234
> 1247963869
> 1611845387
> 1529973242
> 2093650929
> 1860635684
> 1497261229
> ...
>
> which differs from A260083: 326511477, 1362174608, 903267448, 656347688,
> 1853455872, ...
>
> My results are compliant with the initialization by seed=1 of the internal
> function given in PARI's current source code in function random.c
>
> void pari_init_rand(void) { init_xor4096i(1); }
>
> I get the same result by running Richard Brent's source code from the link
> http://wwwmaths.anu.edu.au/~brent/ftp/random/xorgens305.tar.gz provided at
> http://maths-people.anu.edu.au/~brent/random.html
>
> With an initialization by the seed 1, the function UINT xor4096i(UINT
> seed)  provided by R. Brent yields the 64-bit number sequence in the first
> column, and the PARI random numbers by a right shift of 33.
>
> const int seed0=1;
>
> int main() {
>  UINT i, x, xp, seed=seed0;
>  x = xor4096i(seed);
>  printf("First random number  %llu %lu %llu\n",x, x>>33, seed);
>  for (i=0; i<20; i++) { x=xor4096i(0); xp = x>>33; printf ("%llu %lu\n",x,
> xp); }
>
> First random number
> 13282407956253574712 1546275796 1
> 7557322358563246340 879788114
> 14991082624209354397 1745191708
> 6631139461101160670 771966234
> 10719928016004921607 1247963869
> 13845646450878251009 1611845387
> 13142370077570254774 1529973242
> 17984324540840297179 2093650929
> 15982738825684268908 1860635684
> 12861376030615125811 1497261229
> 9837491998535547791 1145234796
> 10009796384580774444 1165293667
> 10598342506117936052 1233809453
> 6743270311476307786 785019983
> 2169871353760194456 252606271
> 959683757796537189 111721893
> 4063307077606482163 473031201
> 8614063320694916486 1002808953
> 5278298332222909972 614474799
> 4049421542817092888 471414712
> 562706585515371056 65507668
>
> I tried all possible 32-bit seeds, but failed to produce the first term of
> A260083, 326511477.
>
> Can someone please try to run a recent version of PARI to check my and
> Felix's results?
>
> Hugo Pfoertner
>
> --
> Seqfan Mailing list - http://list.seqfan.eu/
> 




More information about the SeqFan mailing list