login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249132 Smallest noncomposite k such that prime(n) is the largest prime factor of k^2+1, or 0 if no such k exists. 1

%I #30 Nov 16 2014 12:02:22

%S 1,0,2,0,0,5,13,0,0,17,0,31,73,0,0,23,0,11,0,0,173,0,0,233,463,293,0,

%T 0,251,919,0,0,37,0,193,0,443,0,0,599,0,19,0,467,211,0,0,0,0,107,89,0,

%U 659,0,241,0,2503,0,337,53,0,3671,0,0

%N Smallest noncomposite k such that prime(n) is the largest prime factor of k^2+1, or 0 if no such k exists.

%C a(A080148(m)) = 0. - _Joerg Arndt_, Oct 22 2014

%H Robert Israel, <a href="/A249132/b249132.txt">Table of n, a(n) for n = 1..10000</a>

%e a(1)=1 is in this sequence because 1 is in A008578 and the largest prime factor of 1^2+1 = 2 is prime(1).

%p A249132:= proc(n) local p,i,k,a,b;

%p p:= ithprime(n);

%p if p mod 4 = 3 then return 0 fi;

%p a:= numtheory:-msqrt(-1,p);

%p if a < p/2 then b:= p-a

%p else b:= a; a:= p-a

%p fi;

%p for i from 0 do

%p for k in [a+i*p,b+i*p] do

%p if isprime(k) and p = max(numtheory:-factorset(k^2+1)) then

%p return(k)

%p fi

%p od

%p od

%p end proc:

%p 1,seq(A249132(n),n=2..100); # _Robert Israel_, Nov 10 2014

%t a249132[n_Integer] := Module[{t = Table[0, {n}], k, s, p}, Do[If[Mod[Prime[k], 4] == 3, t[[k]] = -1], {k, n}]; k = 0; While[Times @@ t == 0, k++; s = FactorInteger[k^2 + 1][[-1, 1]]; p = PrimePi[s]; If[p <= n && t[[p]] == 0 && ! CompositeQ[k], t[[p]] = k]]; t /. -1 -> 0]; a249132[120] (* _Michael De Vlieger_, Nov 11 2014, adapted from A223702 *)

%Y Cf. A080148, A185389, A223702, A223705.

%K nonn

%O 1,3

%A _Juri-Stepan Gerasimov_, Oct 22 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 11:35 EDT 2024. Contains 371912 sequences. (Running on oeis4.)