OFFSET
1,1
COMMENTS
Subsequence of primes of A106039. - Michel Marcus, May 03 2015
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
Prime(37) = 157 = (1+5+7)*12 + 1.
Prime(40) = 173 = (1+7+3)*15 + 1+7.
Prime(42) = 181 = (1+8+1)*18 + 1.
MATHEMATICA
terms = {}; (Do[p = Prime[n]; iD = IntegerDigits[p]; iD[[0]] = 0;
a = Apply[Plus, iD]; pf = p - Mod[p, Floor[p/a]*a];
(Do[pf = pf + Apply[Plus, iD[[i]]];
If[pf == p, AppendTo[terms, pf]], {i, 0, IntegerLength[Prime[n]]}]), {n,
1, 1000}]); Union[terms]
PROG
(PARI) isok(n) = {my(v = divrem(n, sumdigits(n))[2]); if (!v, return (1)); d = digits(n); for (i=1, #d, v -= d[i]; if (!v, return (1)); ); return (0); }
lista(nn) = forprime (n=1, nn, if (isok(n), print1(n, ", "))); \\ Michel Marcus, May 03 2015
(Haskell)
a253717 n = a253717_list !! (n-1)
a253717_list = filter ((== 1) . a010051') a106039_list
-- Reinhard Zumkeller, May 07 2015
CROSSREFS
KEYWORD
nonn,base
AUTHOR
V.J. Pohjola, May 02 2015
STATUS
approved