|
|
A341702
|
|
a(n) is the smallest k < n such that the decimal concatenation n||n-1||n-2||...||n-k is prime, or -1 if no such prime exists.
|
|
4
|
|
|
-1, -1, 0, 0, 1, 0, -1, 0, -1, -1, 1, 0, -1, 0, -1, -1, -1, 0, -1, 0, -1, -1, 1, 0, 1, 12, -1, 4, -1, 0, -1, 0, -1, -1, 1, -1, -1, 0, -1, -1, -1, 0, 1, 0, -1, -1, 7, 0, 7, -1, -1, 4, 15, 0, -1, 12, 9, -1, 1, 0, 13, 0, -1, -1, -1, -1, -1, 0, 57, -1, 1, 0, -1, 0
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
0,26
|
|
COMMENTS
|
A variation of A341716. a(n) = n-1 for n = 82. Are there other n such that a(n) = n-1?
Similar argument as in A341716 shows that if n > 3 and a(n) >= 0, then n-a(n) is odd, a(n) !== 2 (mod 3) and 2n-a(n) !== 0 (mod 3).
|
|
LINKS
|
|
|
FORMULA
|
a(p) = 0 if and only if p is prime.
|
|
EXAMPLE
|
a(10) = 1 since 109 is prime. a(22) = 1 since 2221 is prime.
|
|
MAPLE
|
tcat:= proc(x, y) x*10^(1+ilog10(y))+y end proc:
f:= proc(n) local x, k;
x:= n;
for k from 0 to n-1 do
if isprime(x) then return k fi;
x:= tcat(x, n-k-1)
od;
-1
end proc:
|
|
PROG
|
(Python)
from sympy import isprime
k, m = n, n-1
while not isprime(k) and m > 0:
k = int(str(k)+str(m))
m -= 1
return n-m-1 if isprime(k) else -1
(PARI) a(n) = my(k=0, s=Str(n)); while (!isprime(eval(s)), k++; n--; if (k>=n, return(-1)); s = concat(s, Str(n-k))); return(k); \\ Michel Marcus, Mar 02 2022
|
|
CROSSREFS
|
|
|
KEYWORD
|
sign,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|