Thread: Switching digits test View Single Post
 2016-03-16, 04:36 #7 LaurV Romulan Interpreter     Jun 2011 Thailand 3×2,957 Posts Let's totally confuse the poor guy... Single line pari/gp to write 20 primes, based on idea that there are n/log(n) primes there, so finding a random one won't take more than few milliseconds (one in 28*log(10)~=64 random trials will be prime). Code: gp > cnt=0; while(cnt<20,w=vecextract(v=eval(Vec("9293392505711486960894715862")),numtoperm(#v,random((#v)!)));if(isprime(s=sum(x=1,#w,w[x]*10^(#w-x))),print(s);cnt++)) 9182515166396028053899494277 5790252548878614912396160939 8065193970459846172863122599 821379790684859221594159663 2498239697461105998682175053 2875349516987619625293009841 9346719526110843569258970289 4214029397039916216865887559 9635892650907162274541988139 7341063961072859499825562819 513549761509632862849982179 7589344367589019966852211029 3114429320666258958905178997 5690190229723199638884574561 4808306291559199227865743169 4052135849669315891722986709 5875249935961716094202881693 7165899439027916658280945213 4402971315966388620295959187 9340551886459861239129076729 time = 181 ms. gp > The shorter ones have starting zeroes. Well... I could do one more test... But you like my string-to-vector-to-random-permutation-to-number functions huh? edit: how can I replace the sum? I would like a vector-to-string function, or a concat combination, which would not do any calculus, for even more obfuscation, but I don't know such pari function Last fiddled with by LaurV on 2016-03-16 at 04:46