This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A241476 #16 Aug 05 2019 02:49:15 %S A241476 1,2,2,5,2,2,5,2,5,2,17,2,17,5,5,2,2,2,2,65,5,37,2,26,5,2,5,2,10,5,65, %T A241476 2,5,2,2,82,5,2,5,2,2,2,101,5,2,170,2,5,2,10,5,26,37,26,5,5,2,26,5,26, %U A241476 5,2,5,17,10,2,37,10,2,2,5,26,10,2,2,5,2,5,17,26 %N A241476 Least positive primitive root g < prime(n) modulo prime(n) with g - 1 a square, or 0 if such a number g does not exist. %C A241476 According to the conjecture in A239957, a(n) should be always positive. %H A241476 Zhi-Wei Sun, <a href="/A241476/b241476.txt">Table of n, a(n) for n = 1..10000</a> %H A241476 Z.-W. Sun, <a href="http://arxiv.org/abs/1405.0290">New observations on primitive roots modulo primes</a>, arXiv preprint arXiv:1405.0290 [math.NT], 2014. %e A241476 a(4) = 5 since 2^2 + 1 = 5 is a primitive root modulo prime(4) = 7, but neither 0^1 + 1 = 1 nor 1^1 + 1 = 2 is a primitive root modulo prime(4) = 7. %t A241476 f[k_]:=k^2+1 %t A241476 dv[n_]:=Divisors[n] %t A241476 Do[Do[Do[If[Mod[f[k]^(Part[dv[Prime[n]-1],i]),Prime[n]]==1,Goto[aa]],{i,1,Length[dv[Prime[n]-1]]-1}];Print[n," ",k^2+1];Goto[bb];Label[aa];Continue,{k,0,Sqrt[Prime[n]-2]}];Print[n," ",0];Label[bb];Continue,{n,1,80}] %o A241476 (PARI) ispr(n,p)=my(f=factor(p-1)[,1],m=Mod(n,p));for(i=1,#f, if(m^(p\f[i])==1, return(0))); m^(p-1)==1 %o A241476 a(n)=my(p=prime(n));for(k=0,sqrtint(p-2),if(ispr(k^2+1,p), return(k^2+1)));0 \\ _Charles R Greathouse IV_, May 01 2014 %Y A241476 Cf. A000040, A002522, A239957, A239963, A241472. %K A241476 nonn %O A241476 1,2 %A A241476 _Zhi-Wei Sun_, Apr 23 2014