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.
%I A353020 #61 Jul 29 2025 19:08:24 %S A353020 4,7,9,14,15,16,17,25,26,27,28,29,35,43,44,45,46,47,55,56,57,58,64,71, %T A353020 73,74,75,76,77,78,79,83,85,86,87,96,99,107,109,110,111,112,113,117, %U A353020 123,125,133,139,140,141,142,143,148,151,152,153,154,155,156,157,158 %N A353020 Every term is the absolute difference of a prime and a nonprime that is also the sum of their indices. %C A353020 More than one pair of a prime and a nonprime may correspond to some of the terms. %C A353020 Sequence A352707 is read by ascending antidiagonals from array T(n,k). Present sequence is those differences T(n,k) which are on their own antidiagonal number n + k. %C A353020 . %C A353020 Array T(n,k) = abs(prime(n)-nonprime(k)) %C A353020 n\k| 1 4 6 8 9 ... %C A353020 ----------------------- %C A353020 2 | 1 2 4 6 7 ... %C A353020 3 | 2 1 3 5 6 ... %C A353020 5 | 4 1 1 3 4 ... %C A353020 7 | 6 3 1 1 2 ... %C A353020 11 | 10 7 5 3 2 ... %C A353020 13 | 12 9 7 5 4 ... %C A353020 17 | 16 13 11 9 8 ... %C A353020 19 | 18 15 13 11 10 ... %C A353020 23 | 22 19 17 15 14 ... %C A353020 . | . . . . . %H A353020 Robert Israel, <a href="/A353020/b353020.txt">Table of n, a(n) for n = 1..3000</a> %F A353020 Sums x + y for which x + y = abs(prime(x) - nonprime(y)), for some x and y. %e A353020 7 is a term because the 5th prime 11 minus the 2nd nonprime 4 equals 7 and that is also 5 + 2. %e A353020 9 is a term because the 2nd prime 3 minus the 7th nonprime 12 equals -9 whose absolute value 9 is also 2 + 7. %e A353020 4 is a term because the 3rd prime 5 minus the 1st nonprime 1 equals 4 that is also 3 + 1. The absolute value of the 1st prime 2 minus the 3rd nonprime 6 also equals 4 that is 1 + 3, so this pair, too, makes 4 a term of this sequence. %p A353020 M:= 1000: %p A353020 P:= NULL: C:= NULL: np:= 0: nc:= 0: %p A353020 for x from 1 while np < M do %p A353020 if isprime(x) then %p A353020 np:= np+1; P:= P,x %p A353020 elif nc < M then %p A353020 nc:= nc+1; C:= C,x %p A353020 fi %p A353020 od: %p A353020 filter:= proc(x) local i; %p A353020 ormap(i -> abs(P[i] - C[x-i]) = x, [$1..x-1]); %p A353020 end proc: %p A353020 select(filter, [$1..M]); # _Robert Israel_, Jul 29 2025 %Y A353020 Cf. A000040, A018252, A352707 (table T). %K A353020 nonn %O A353020 1,1 %A A353020 _Tamas Sandor Nagy_, Apr 17 2022 %E A353020 More terms from _Hugo Pfoertner_, Apr 17 2022