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.

A346786 If a(n) is prime, then a(n) + a(n+1) is prime; if a(n) is not prime, then a(n) + a(n+1) is not prime. This is also true for pairs of consecutive digits: if the first one is prime, the sum of the pair is also prime; if the first one is nonprime, the sum of the pair is nonprime. This is the lexicographically earliest sequence of distinct terms > 0 with this property.

Original entry on oeis.org

2, 1, 3, 4, 5, 6, 8, 7, 40, 9, 13, 46, 20, 10, 15, 21, 30, 18, 17, 42, 32, 19, 34, 23, 44, 25, 29, 38, 48, 45, 60, 62, 50, 64, 52, 56, 63, 80, 66, 68, 70, 82, 58, 74, 69, 76, 84, 81, 87, 401, 86, 88, 100, 90, 93, 201, 91, 95, 200, 96, 99, 97, 406, 204, 206, 208, 101, 300
Offset: 1

Views

Author

Eric Angelini and Carole Dubois, Aug 03 2021

Keywords

Examples

			a(1) = 2 (prime) and a(1) + a(2) = 2 + 1 = 3 [which is prime, like a(1)];
a(2) = 1 (nonprime) and a(2) + a(3) = 1 + 3 = 4 [which is nonprime, like a(2)];
a(3) = 3 (prime) and a(3) + a(4) = 3 + 4 = 7 [which is prime, like a(3)];
a(4) = 4 (nonprime) and a(4) + a(5) = 4 + 5 = 9 [which is nonprime, like a(4)];
a(5) = 5 (prime) and a(5) + a(6) = 5 + 6 = 11 [which is prime, like a(5)];
(...)
a(8) = 7 (prime) and a(8) + a(9) = 7 + 40 = 47 [which is prime, like a(8)];
now we have to consider also the digits of the pair (7,4); they are "7", the last digit of a(8), and "4", the first digit of a(9): as the first digit of the pair is prime (7), the sum of this 7 and the next digit (4) has to be prime too, which is the case, 4 + 7 = 11;
a(9) = 40 (nonprime) and a(9) + a(10) = 40 + 9 = 49 [which is nonprime, like a(9)];
the next pair of digits we have to consider after (7,4) is (4,0); as 4 is nonprime, so has to be the sum 4 + 0 (which is the case as 4 + 0 = 4); etc.
		

Crossrefs

Cf. A219110.

Programs

  • Mathematica
    t[x_,y_]:=If[PrimeQ@x,PrimeQ[x+y],!PrimeQ[x+y]];a[1]=2;a[n_]:=a[n]=Block[{k=1},While[MemberQ[Array[a,n-1],k]||!And@@(t@@@Partition[Flatten[IntegerDigits/@Join[Array[a,n-1],{k}]],2,1])||!t@@{a[n-1],k},k++];k];Array[a,68] (* Giorgos Kalogeropoulos, May 09 2022 *)