login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A138792
Least prime, p, such that p mod (sum of the digits of p) = n.
3
2, 11, 67, 23, 89, 53, 83, 29, 173, 19, 197, 193, 337, 167, 269, 79, 757, 397, 379, 479, 3677, 769, 997, 6967, 1699, 3889, 9857, 7867, 6959, 9949, 16987, 9887, 49697, 47599, 18899, 67979, 73999, 56999, 197699, 49999, 159899, 189989, 98899, 98999, 988877
OFFSET
0,1
COMMENTS
First occurrence of n in A136251.
LINKS
David A. Corneth, Table of n, a(n) for n = 0..181 (first 74 terms from Robert G. Wilson v)
EXAMPLE
a(2) = 67 = 13*5+2 <--> 67 (mod 13) = 2.
MAPLE
V:= Array(0..50): count:= 0: p:= 1:
while count < 51 do
p:= nextprime(p);
s:= convert(convert(p, base, 10), `+`);
v:= p mod s;
if v <= 50 and V[v] = 0 then V[v]:= p; count:= count+1; fi
od:
convert(V, list); # Robert Israel, Mar 07 2023
MATHEMATICA
f[n_] := Block[{p = Prime@ n}, Mod[p, Plus @@ IntegerDigits@ p]]; t = Table[0, {1000}]; Do[ a = f@n; If[a < 1000 && t[[a + 1]] == 0, t[[a + 1]] = Prime@ n; Print[{a, Prime@n}]], {n, 503200000}]
lp[n_]:=Module[{p=2}, While[Mod[p, Total[IntegerDigits[p]]]!=n, p= NextPrime[ p]]; p]; Array[lp, 50, 0] (* Harvey P. Dale, Jan 15 2019 *)
PROG
(PARI) a(n) = my(p=2); while ((p % sumdigits(p)) != n, p=nextprime(p+1)); p; \\ Michel Marcus, Mar 07 2023
(Python)
from sympy import nextprime
from itertools import islice
def agen(): # generator of terms
adict, n, p = dict(), 0, 2
while True:
v = p%sum(map(int, str(p)))
if v not in adict: adict[v] = p
while n in adict: yield adict[n]; n += 1
p = nextprime(p)
print(list(islice(agen(), 45))) # Michael S. Branicky, Mar 07 2023
CROSSREFS
Sequence in context: A185627 A216585 A245277 * A058056 A266579 A063768
KEYWORD
base,nonn
AUTHOR
Robert G. Wilson v, Mar 28 2008
EXTENSIONS
Name corrected by Robert Israel, Mar 07 2023
STATUS
approved