OFFSET
1,1
COMMENTS
a(n) = 1 if and only if prime(n) is a Mersenne prime. - Ely Golden, Feb 06 2017
LINKS
FORMULA
EXAMPLE
a(5)=3 because 5th prime is 11 and 11=3*2^2-1.
MATHEMATICA
Table[Max[Select[Divisors[Prime[n]+1], OddQ]], {n, 100}] (* Daniel Jolly, Nov 15 2014 *)
PROG
(Sage) def a(n):
x=nth_prime(n)+1
return x/2**((int(x)&int(-x)).bit_length()-1)
index=1
while(index<=10000):
print(str(index)+" "+str(a(index)))
index+=1
# Ely Golden, Feb 06 2017
(PARI) a(n) = (prime(n)+1)/2^valuation(prime(n)+1, 2); \\ Michel Marcus, Feb 05 2017
(Magma)
A057024:= func< n | (NthPrime(n)+1)/2^Valuation(NthPrime(n)+1, 2) >;
[A057024(n): n in [1..100]]; // G. C. Greubel, Aug 06 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Henry Bottomley, Jul 24 2000
STATUS
approved