OFFSET
1,1
COMMENTS
Inspired by the 134th problem of Project Euler (see link).
a(n) > 1 iff n != 2.
Some particular terms:
a(3) = 35 is the concatenation of prime(2) and prime(3),
a(4) = 77 is the palindrome prime(4) and prime(4),
a(13) = 3741 is the concatenation of prime(12) and prime(13),
a(25) = 9797 is the concatenation of prime(25) and prime(25).
LINKS
Chai Wah Wu, Table of n, a(n) for n = 1..10000
Project Euler, Problem 134: Prime pair connection.
EXAMPLE
For prime(2) = 3 and prime(3) = 5, there does not exist any integer that ends with 3 and is divisible by 5, hence a(2)=0 and it is the only term equal to 0.
For prime(5) = 11 and prime(6) = 13, 611 ends with 11 and 611=13*47 is divisible by 13, and no integer < 611 satisfies these two conditions, so a(5)= 611.
MATHEMATICA
a[2] = 0; a[n_] := Module[{p = Prime[n], q, r}, q = NextPrime[p]; r = 10^Ceiling[Log10[p]]; While[!Divisible[p, q], p += r]; p]; Array[a, 100] (* Amiram Eldar, Mar 27 2020 *)
PROG
(PARI) a(n) = {if (n==2, return(0)); my(p = prime(n), q = prime(n+1), x = p, k = 0); until ((x % q) == 0, k++; x = eval(concat(Str(k), Str(p))); ); x; } \\ Michel Marcus, Mar 28 2020
(PARI) a(n) = { if (n==2, return (0), my (p=prime(n), q=nextprime(p+1)); lift(chinese(Mod(p, 10^#digits(p)), Mod(0, q)))) } \\ Rémy Sigrist, Mar 29 2020
(Python)
from sympy import prime, nextprime, mod_inverse
def A333577(n):
if n == 2:
return 0
p = prime(n)
q, r = nextprime(p), 10**len(str(p))
return p*q*mod_inverse(q, r) % (q*r) # Chai Wah Wu, Mar 31 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Bernard Schott, Mar 27 2020
EXTENSIONS
More terms from Amiram Eldar, Mar 27 2020
Name improved by Rémy Sigrist, Mar 29 2020
STATUS
approved