cp's OEIS Frontend

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.

A240509 Least number k > 0 such that n^k - (n-1)^k - ... - 3^k - 2^k is prime, or 0 if no such k exists.

Original entry on oeis.org

1, 2, 2, 0, 0, 4, 5, 0, 0, 10, 27, 0, 0, 13, 18, 0, 0, 26, 57, 0, 0, 16, 35, 0, 0, 219, 19, 0, 0, 373, 48, 0, 0, 35, 33, 0, 0, 94, 93, 0, 0, 225, 47, 0, 0, 47, 223, 0, 0, 3227, 49, 0, 0, 199, 127, 0, 0, 45, 67, 0, 0, 65, 123, 0, 0, 103
Offset: 2

Views

Author

Derek Orr, Apr 06 2014

Keywords

Comments

a(n) = 0 if and only if n == 1 or 2 mod 4. This is because of the parity of the number given. For n = 1, 2, 5, 6, 9, 10, 13, 14,... any k-value will return an even number. Thus, it will never be prime. The only exception is for n = 1, where it will return 1, still not a prime. Further when n = 2, it only returns even numbers; however, 2 is a prime and thus, a(2) = 1.
A prime number is in the sequence A000040.
Next term a(68) is most likely > 5000.

Examples

			7^1 - 6^1 - 5^1 - 4^1 - 3^1 - 2^1 = -13 is not prime. 7^2 - 6^2 - 5^2 - 4^2 - 3^2 - 2^2 = -41 is not prime. 7^3 - 6^3 - 5^3 - 4^3 - 3^3 - 2^3 = -97 is not prime. 7^4 - 6^4 - 5^4 - 4^4 - 3^4 - 2^4 = 127 is prime. Thus, a(7) = 4.
		

Crossrefs

Programs

  • PARI
    a(n)=for(k=1,5000,if(ispseudoprime(n^k-sum(i=2,n-1,i^k)),return(k)));
    n=1; while(n<100,print1(a(n), ", ");n+=1)