? p=primes([2,10^5]);for(k=1,100,v=[];for(n=1,100,x=n^(k*n+1)+k*n+1;for(i=1,#p,if(p[i]>=x,break);if(x%p[i]==0,next(2)));if(ispseudoprime(x),v=concat(v,[n])));if(#v>0,print("k=",k,",n=",v)))
k=1,n=[1, 2]
k=2,n=[2, 4]
k=3,n=[1]
k=4,n=[2]
k=5,n=[1]
k=7,n=[2]
k=9,n=[1, 4]
k=11,n=[1, 3]
k=15,n=[1]
k=17,n=[1]
k=19,n=[2]
k=21,n=[1, 4]
k=27,n=[1]
k=29,n=[1]
k=33,n=[4]
k=35,n=[1]
k=37,n=[2]
k=39,n=[1]
k=40,n=[2]
k=41,n=[1]
k=44,n=[2]
k=45,n=[1, 10]
k=51,n=[1]
k=56,n=[4]
k=57,n=[1]
k=59,n=[1]
k=65,n=[1]
k=69,n=[1, 23]
k=71,n=[1]
k=77,n=[1]
k=81,n=[1]
k=87,n=[1]
k=95,n=[1]
k=99,n=[1]
time = 25min, 36,657 ms.