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.

Showing 1-1 of 1 results.

A320771 Primes p for which p-1 and p+1 are Niven numbers.

Original entry on oeis.org

2, 3, 5, 7, 11, 19, 41, 71, 101, 109, 113, 151, 191, 199, 223, 229, 307, 401, 409, 449, 593, 701, 881, 911, 1009, 1013, 1091, 1129, 1231, 1301, 1303, 1451, 1559, 1811, 1999, 2029, 2089, 2213, 2281, 2311, 2351, 2399, 2531, 2609, 2711, 2753, 3037, 3079, 3109, 3221, 3251, 3329
Offset: 1

Views

Author

Marius A. Burtea, Oct 21 2018

Keywords

Comments

All of the prime numbers in sequences A253213, A199684, A199687 are part of the sequence.

Examples

			For p = 11, p-1 = 10 and p + 1 = 12. 10 is divisible by 1 = 1 + 0, 12 is divisible by 3 = 1 + 2. Thus, p = 11 is a term.
For p = 229, p-1 = 228 and p + 1 = 230. 228 is divisible by 12 = 2 + 2 + 8, and 230 is divisible by 5 = 2 + 3 + 0. Thus, p = 229 is a term.
		

Crossrefs

Programs

  • GAP
    Filtered([2..2400],p->IsPrime(p) and (p-1) mod List(List([1..p-1],ListOfDigits),Sum)[p-1]=0 and (p+1) mod List(List([1..p+1],ListOfDigits),Sum)[p+1]=0); # Muniru A Asiru, Oct 29 2018
    
  • Magma
    [p: p in PrimesUpTo(2000) | IsIntegral((p-1)/&+Intseq(p-1)) and IsIntegral((p+1)/&+Intseq(p+1))]; // Marius A. Burtea, Jan 06 2019
  • Mathematica
    nivenQ[n_] := Divisible[n, Total[IntegerDigits[n]]]; Select[Range[10000], PrimeQ[#] && nivenQ[#-1] && nivenQ[#+1] &] (* Amiram Eldar, Oct 31 2018 *)
    nnQ[p_]:=Divisible[p,Total[IntegerDigits[p]]]; Select[Prime[Range[500]],AllTrue[#+{1,-1},nnQ]&] (* Harvey P. Dale, Jul 19 2023 *)
  • PARI
    isniven(n) = frac(n/sumdigits(n)) == 0;
    isok(p) = isprime(p) && isniven(p-1) && isniven(p+1); \\ Michel Marcus, Oct 22 2018
    
Showing 1-1 of 1 results.