OFFSET
1,1
LINKS
Marius A. Burtea, Table of n, a(n) for n = 1..11188
EXAMPLE
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.
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 *)
PROG
(PARI) isniven(n) = frac(n/sumdigits(n)) == 0;
isok(p) = isprime(p) && isniven(p-1) && isniven(p+1); \\ Michel Marcus, Oct 22 2018
(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
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Marius A. Burtea, Oct 21 2018
STATUS
approved