login
Numbers k such that k + prime(k) is divisible by 11.
2

%I #11 Apr 30 2021 10:19:42

%S 4,30,36,41,45,56,60,73,84,89,95,127,128,134,156,183,193,194,201,239,

%T 244,251,284,302,323,331,348,360,368,372,387,391,409,413,431,432,442,

%U 454,463,496,514,516,546,565,568,620,629,636,646,667,684,696,703,705

%N Numbers k such that k + prime(k) is divisible by 11.

%H Michael S. Branicky, <a href="/A108559/b108559.txt">Table of n, a(n) for n = 1..10000</a>

%e 30 + prime(30) = 30 + 113 = 143 = 13*11.

%t A108559=Select[Range[800], Mod[Prime[ # ]+#, 11]==0&]

%o (Python)

%o from sympy import prime

%o def ok(n): return (n + prime(n))%11 == 0

%o print(list(filter(ok, range(1, 706)))) # _Michael S. Branicky_, Apr 30 2021

%o (Python) # much faster version

%o from sympy import nextprime

%o def aupton(terms):

%o p, p_idx, alst = 1, 0, []

%o while len(alst) < terms:

%o p, p_idx = nextprime(p), p_idx+1

%o if (p_idx + p)%11 == 0: alst.append(p_idx)

%o return alst

%o print(aupton(54)) # _Michael S. Branicky_, Apr 30 2021

%Y Cf. A108560.

%K easy,nonn

%O 1,1

%A _Zak Seidov_, Jun 10 2005