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!)
A360738 a(n) = A084740(n) - 1. 0
1, 1, 2, 1, 2, 1, 4, 2, -1, 1, 16, 1, 4, 2, 2, 1, 2, 1, 18, 2, 2, 1, 4, 2, -1, 6, 2, 1, 4, 1, 6, -1, 2, 12, 312, 1, 12, 2, 348, 1, 2, 1, 4, 4, 18, 1, 126, 18, -1, 2, 4228, 1, 10, 2, 16, 6, 2, 1, 2, 1, 6, 2, 4, -1, 18, 1, 18, 4, 2, 1, 2, 1, 4, 4, 2, 40, 2, 1, 4, 2, -1, 1, 4, 16, 4, 10, 6, 1, 2, 2, 4420 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
a(n) is the smallest k such that 1 + n + n^2 + ... + n^k is a prime. a(n) = -1 if no such k exists.
From Jon E. Schoenfield, Feb 22 2023: (Start)
Let s(n,k) = Sum_{j=0..k} n^j. Then if k+1 is not a prime, s(n,k) is divisible by s(n,j) for some positive j < k, so s(n,k) is not a prime.
Additionally, if n = 2^d (for d >= 1), then if k+1 is a prime, s(n,k) is usually divisible by 2^(k+1)-1. For d <= 16, it seems that the only exceptions are s(4,1) = 5, s(8,2) = 73, s(16,1) = 17, s(32,4) = 601*1801, s(64,1) = 5*13, s(64,2) = 3*19*73, s(128,6) = 4432676798593, s(256,1) = 257, s(512,2) = 262657, s(1024,1) = 5^2*41, s(1024,4) = 251*601*1801*4051, s(2048,10) = 727*p31, s(4096,1) = 17*241, s(4096,2) = 3*19*37*73*109, s(8192,12) = 4057*6740339310641*p31, s(16384,1) = 5*29*113, s(16384,6) = 4363953127297*4432676798593, s(32768,2) = 73*631*23311, s(32768,4) = 601*1801*100801*10567201, s(65536,1) = 65537, and s(131072,16) = 12761663*179058312604392742511009*p52.
So a(32) = -1 because the sum s(32,k) is not prime for any k:
for each k such that k+1 is not a prime, s(32,k) is divisible by s(32,j) for some positive j < k;
for each k such that k+1 is a prime except for k=4, s(32,k) is divisible by 2^(k+1)-1; and
s(32,4) = 601*1801 is a nonprime.
Similarly, a(64) = -1 because the sum s(64,k) is not prime for any k:
for each k such that k+1 is not a prime, s(64,k) is divisible by s(64,j) for some positive j < k;
for each k such that k+1 is a prime except for k=1 and k=2, s(64,k) is divisible by 2^(k+1)-1; and
s(64,1) = 5*13 and s(64,2) = 3*19*73 are nonprime. (End)
LINKS
FORMULA
a((2m+1)^2) = -1 for m >= 1.
PROG
(PARI) a(n, lim=oo)=if((issquare(n)&&n%2==1&&n>1)||n==32||n==64, -1, my(s=1); for(k=1, lim, s+=n^k; if(ispseudoprime(s), return(k)) ); oo) \\ Andrew Howroyd, Feb 22 2023
CROSSREFS
Cf. A084740.
Sequence in context: A334664 A061797 A068341 * A321368 A338508 A100380
KEYWORD
sign
AUTHOR
Ya-Ping Lu, Feb 18 2023
EXTENSIONS
a(32)-a(79) from Jon E. Schoenfield, Feb 21 2023
a(80)-a(91) from Andrew Howroyd, Feb 22 2023
STATUS
approved

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 August 26 06:07 EDT 2024. Contains 375454 sequences. (Running on oeis4.)