login
A333577
a(2) = 0, and otherwise a(n) is the least multiple of prime(n+1) whose decimal representation ends with that of prime(n).
2
12, 0, 35, 77, 611, 1513, 817, 1219, 2523, 1829, 2331, 2337, 3741, 3243, 5247, 3953, 1159, 5561, 5467, 1971, 6873, 1079, 4183, 3589, 9797, 48101, 3103, 46107, 33109, 15113, 120127, 77131, 67137, 76139, 45149, 38151, 104157, 165163, 100167, 87173, 101179, 170181
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).
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
Cf. A000040, A333845 (variant).
Sequence in context: A307170 A332053 A225951 * A278711 A331911 A307841
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