cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A174414 a(n) is the smallest natural number k such that the concatenation (n+k)||k is a prime number.

This page as a plain text file.
%I A174414 #27 Sep 19 2024 02:13:28
%S A174414 3,1,1,3,1,1,3,3,1,9,19,1,3,1,7,3,1,1,3,1,13,17,1,1,3,1,1,3,7,1,9,1,
%T A174414 23,3,3,19,17,7,1,3,1,1,3,21,1,11,3,1,3,7,1,9,1,7,21,1,7,3,1,7,3,1,1,
%U A174414 3,1,17,9,1,1,3,3,7,9,1,1,9,13,7,3,1,1,3,3,11,3,7,1,27,7,1,9,3,1,9,3,1,9,1
%N A174414 a(n) is the smallest natural number k such that the concatenation (n+k)||k is a prime number.
%C A174414 The last digit of a(n) must be 1, 3, 7 or 9.
%C A174414 If n and 10^d+1 are not coprime, then a(n) cannot have d digits. - _Robert Israel_, Sep 16 2024
%D A174414 Theo Kempermann, Zahlentheoretische Kostproben, Harri Deutsch, 2. aktualisierte Auflage 2005.
%D A174414 Helmut Kracke, Mathe-musische Knobelisken, Dümmler Bonn, 2. Auflage 1983.
%D A174414 Hugo Steinhaus, Studentenfutter, Urania-Verlag Leipzig-Jena-Berlin, 1991.
%H A174414 Robert Israel, <a href="/A174414/b174414.txt">Table of n, a(n) for n = 1..10000</a>
%F A174414 a(n) = 1 for n > 1 in A126785.
%e A174414 43 = prime(14) = (3+1)||3, a(1) = 3
%e A174414 31 = prime(11) = (1+2)||1, a(2) = 1
%e A174414 41 = prime(13) = (1+3)||1, a(3) = 1
%e A174414 3413 = prime(480) = (13+21)||13, a(21) = 13
%e A174414 11527 = prime(1390) = (27+88)||27, a(88) = 27
%e A174414 Note cases where consecutive values of n give consecutive primes:
%e A174414 n=17: 181 = prime(42) = (1+17)||1, n=18: 191 = prime(43) = (1+18)||1
%e A174414 k=41: 421 = prime(82) = (1+41)||1, n=42: 431 = prime(83) = (1+42)||1
%e A174414 ... are there infinitely many of such?
%e A174414 a(11) = 19, 3019 is a resulting "candidate" for n = 301 - 9 = 292, but a(292) = 3 gives 2953 = prime(425)
%e A174414 First twice resulting prime is 5623 = prime(739) = (23+33)||23 = 5623 = (559+3)||3
%p A174414 tcat:= proc(a,b) a*10^(1+ilog10(b))+b end proc:
%p A174414 f:= proc(n) local k, d;
%p A174414     for d from 1 do
%p A174414       if igcd(n, 10^d+1) > 1 then next fi;
%p A174414       for k from 10^(d-1)+`if`(d=1, 0, 1) to 10^d by 2 do
%p A174414         if isprime(tcat(n+k, k)) then return k fi
%p A174414     od od
%p A174414 end proc:
%p A174414 map(f, [$1..100]); # _Robert Israel_, Sep 16 2024
%o A174414 (PARI) a(n) = my(k=1); while (!isprime(eval(concat(Str(n+k), Str(k)))), k++); k; \\ _Michel Marcus_, Sep 17 2024
%o A174414 (Python)
%o A174414 from itertools import count
%o A174414 from math import gcd
%o A174414 from sympy import isprime
%o A174414 def A174414(n):
%o A174414     for l in count(1):
%o A174414         if gcd(n,(m:=10**l)+1)==1:
%o A174414             r = m//10
%o A174414             a = m*(n+r)+r
%o A174414             for k in range(r,m):
%o A174414                 if isprime(a):
%o A174414                     return k
%o A174414                 a += m+1 # _Chai Wah Wu_, Sep 18 2024
%Y A174414 Cf. A089712, A126785, A171154, A173976, A174031.
%K A174414 base,nonn
%O A174414 1,1
%A A174414 Ulrich Krug (leuchtfeuer37(AT)gmx.de), Mar 19 2010
%E A174414 Edited and corrected by _Robert Israel_, Sep 16 2024