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.

A239938 a(n) = least number k > 0 such that n*k^n - 1 is prime, or 0 if no such k exists.

Original entry on oeis.org

3, 2, 1, 1, 4, 1, 8, 1, 40, 3, 10, 1, 56, 1, 10, 0, 46, 1, 6, 1, 42, 51, 4, 1, 8, 67, 0, 18, 102, 1, 98, 1, 38, 6, 136, 0, 90, 1, 10, 3, 52, 1, 12, 1, 18, 3, 28, 1, 72, 165, 40, 657, 418, 1, 44, 205, 94, 9, 426, 1, 482, 1, 4, 0, 418, 252, 38, 1, 400, 165, 28, 1, 140
Offset: 1

Views

Author

Derek Orr, Mar 29 2014

Keywords

Comments

a(n) = 1 iff n-1 is prime.
If a(n) = 0 then n is in A097764. Note the converse is not true: a(4) = 1, not 0.
Up to a(1000), the largest term is a(456) = 947310. The PFGW program has been used to certify all the terms up to a(1000), using the 'N+1' deterministic test. - Giovanni Resta, Mar 30 2014

Examples

			1*1^1 - 1 = 0 is not prime. 1*2^1 - 1 = 1 is not prime. 1*3^1 - 1 = 2 is prime. Thus a(1) = 3.
		

Crossrefs

Programs

  • Mathematica
    nope[n_] := n > 4 && Catch@Block[{p = 2}, While[n >= p^p, If[ IntegerQ[ n^(1/p)/p], Throw@ True]; p = NextPrime@ p]; False]; a[n_] := If[nope@ n, 0, Block[{k = 1}, While[! PrimeQ[n*k^n - 1], k++]; k]]; Array[a, 80] (* Giovanni Resta, Mar 30 2014 *)
    A239938[n_] := If[n != 4 && # != 1 && GCD[n, #] != 1 &[GCD @@ FactorInteger[n][[All, -1]]], 0, NestWhile[# + 1 &, 1, Not@PrimeQ[n #^n - 1] &]]; Array[A239938, 73] (* JungHwan Min, Dec 28 2015 *)
  • PARI
    Pro(n) = for(k=1,10^4,if(ispseudoprime(n*k^n-1),return(k)));
    n=1; while(n<100,print1(Pro(n), ", ");n+=1)