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

M. F. Hasler oeis at hasler.fr
Sun Sep 18 21:27:10 CEST 2016


On Sun, Sep 18, 2016 at 2:52 PM, <israel at math.ubc.ca> wrote:

> I get the same numbers as Hugo, on GP/PARI CALCULATOR Version 2.7.4
> (released).
>

On version 2.6.1 (alpha), mingw (ix86/GMP-5.0.1 kernel) 32-bit version, gcc
version 4.6.3
I get Felix' terms (those listed in A260083 <http://oeis.org/A260083>):

(10:35) gp > random
%33 = 326511477

Maybe it's rather a question of 32 vs 64 bit, or mingw vs native linux
and/or gcc version ?
-- 
Maximilian


> On Sep 18 2016, Hugo Pfoertner wrote:
>
> 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
>>
>



More information about the SeqFan mailing list