login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers k such that (largest digit of k) + (largest digit of k+1) is prime.
1

%I #20 Aug 03 2022 10:38:27

%S 1,2,3,5,6,8,10,11,12,13,15,16,18,19,22,23,25,26,28,33,35,36,38,39,45,

%T 46,48,55,56,58,66,68,78,79,88,100,101,102,103,105,106,108,110,111,

%U 112,113,115,116,118,119,122,123,125,126,128,133,135,136,138,139,145,146

%N Numbers k such that (largest digit of k) + (largest digit of k+1) is prime.

%C No terms contain digit 9 before a non-9. - _Robert Israel_, May 20 2020

%H Robert Israel, <a href="/A095976/b095976.txt">Table of n, a(n) for n = 1..10000</a>

%e 12348 is in the sequence because 8 (its largest digit) plus 9 (the largest digit of 12349) equals 17 (a prime).

%p N:= 500: # to get terms <= N

%p L:= map(t -> max(convert(t,base,10)), [$1..N+1]):

%p LL:= L[1..-2]+L[2..-1]:

%p select(t -> member(LL[t], {2, 3, 5, 7, 11, 13, 17}), [$1..N]); # _Robert Israel_, May 20 2020

%t ldQ[n_]:=Module[{ldn=Max[IntegerDigits[n]],ldn1=Max[IntegerDigits[ n+1]]}, PrimeQ[ldn+ldn1]]; Select[Range[150],ldQ] (* _Harvey P. Dale_, Apr 29 2011 *)

%o (PARI) isok(m) = isprime(vecmax(digits(m))+vecmax(digits(m+1))); \\ _Michel Marcus_, May 20 2020

%o (Python)

%o def ok(n): return int(max(str(n))) + int(max(str(n+1))) in {2, 3, 5, 7, 11, 13, 17}

%o print([k for k in range(147) if ok(k)]) # _Michael S. Branicky_, Aug 03 2022

%Y Cf. A054055.

%K base,easy,nonn

%O 1,2

%A _Jason Earls_, Jul 16 2004