[go: up one dir, main page]

login
Search: a253074 -id:a253074
     Sort: relevance | references | number | modified | created      Format: long | short | data
a(n) is the smallest positive integer not already in the sequence such that a(n)+a(n-1) is prime, starting with a(1)=1.
+10
40
1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 13, 16, 15, 14, 17, 12, 11, 18, 19, 22, 21, 20, 23, 24, 29, 30, 31, 28, 25, 34, 27, 26, 33, 38, 35, 32, 39, 40, 43, 36, 37, 42, 41, 48, 49, 52, 45, 44, 53, 50, 47, 54, 55, 46, 51, 56, 57, 70, 61, 66, 65, 62, 69, 58, 73, 64, 63, 68, 59, 72, 67, 60
OFFSET
1,2
COMMENTS
The sequence is well-defined (the terms must alternate in parity, and by Dirichlet's theorem a(n+1) always exists). - N. J. A. Sloane, Mar 07 2017
Does every positive integer eventually occur? - Dmitry Kamenetsky, May 27 2009. Reply from Robert G. Wilson v, May 27 2009: The answer is almost certainly yes, on probabilistic grounds.
It appears that this is the limit of the rows of A051237. That those rows do approach a limit seems certain, and given that that limit exists, that this sequence is the limit seems even more likely, but no proof is known for either conjecture. - Robert G. Wilson v, Mar 11 2011, edited by Franklin T. Adams-Watters, Mar 17 2011
The sequence is also a particular case of "among the pairwise sums of any M consecutive terms, N are prime", with M = 2, N = 1. For other M, N see A055266 & A253074 (M = 2, N = 0), A329333, A329405 - A329416, A329449 - A329456, A329563 - A329581, and the OEIS Wiki page. - M. F. Hasler, Feb 11 2020
LINKS
Zak Seidov, Table of n, a(n) for n = 1..10000 (First 1000 terms from T. D. Noe)
N. J. A. Sloane, Table of n, a(n) for n = 1..100000 (computed using Orlovsky's Mma program)
M. F. Hasler, Prime sums from neighboring terms, OEIS Wiki, Nov. 23, 2019
FORMULA
a(2n-1) = A128280(2n-1) - 1, a(2n) = A128280(2n) + 1, for all n >= 1. - M. F. Hasler, Feb 11 2020
EXAMPLE
a(5) = 7 because 1, 2, 3 and 4 have already been used and neither 4 + 5 = 9 nor 4 + 6 = 10 are prime while 4 + 7 = 11 is prime.
MAPLE
A055265 := proc(n)
local a, i, known ;
option remember;
if n =1 then
1;
else
for a from 1 do
known := false;
for i from 1 to n-1 do
if procname(i) = a then
known := true;
break;
end if;
end do:
if not known and isprime(procname(n-1)+a) then
return a;
end if;
end do:
end if;
end proc:
seq(A055265(n), n=1..100) ; # R. J. Mathar, Feb 25 2017
MATHEMATICA
f[s_List] := Block[{k = 1, a = s[[ -1]]}, While[ MemberQ[s, k] || ! PrimeQ[a + k], k++ ]; Append[s, k]]; Nest[f, {1}, 71] (* Robert G. Wilson v, May 27 2009 *)
q=2000; a={1}; z=Range[2, 2*q]; While[Length[z]>q-1, k=1; While[!PrimeQ[z[[k]]+Last[a]], k++]; AppendTo[a, z[[k]]]; z=Delete[z, k]]; Print[a] (*200 times faster*) (* Vladimir Joseph Stephan Orlovsky, May 03 2011 *)
PROG
(HP 50G Calculator) << DUPDUP + 2 -> N M L << { 1 } 1 N 1 - FOR i L M FOR j DUP j POS NOT IF THEN j DUP 'L' STO M 'j' STO END NEXT OVER i GET SWAP WHILE DUP2 + DUP ISPRIME? NOT REPEAT DROP DO 1 + 3 PICK OVER POS NOT UNTIL END END ROT DROP2 + NEXT >> >> Gerald Hillier, Oct 28 2008
(Haskell)
import Data.List (delete)
a055265 n = a055265_list !! (n-1)
a055265_list = 1 : f 1 [2..] where
f x vs = g vs where
g (w:ws) = if a010051 (x + w) == 1
then w : f w (delete w vs) else g ws
-- Reinhard Zumkeller, Feb 14 2013
(PARI) v=[1]; n=1; while(n<50, if(isprime(v[#v]+n)&&!vecsearch(vecsort(v), n), v=concat(v, n); n=0); n++); v \\ Derek Orr, Jun 01 2015
(PARI) U=-a=1; vector(100, k, k=valuation(1+U+=1<<a, 2); while(bittest(U, k)|| !isprime(a+k), k++); a=k) \\ M. F. Hasler, Feb 11 2020
CROSSREFS
Inverse permutation: A117922; fixed points: A117925; A117923=a(a(n)). - Reinhard Zumkeller, Apr 03 2006
Cf. A086527 (the primes a(n)+a(n-1)).
Cf. A070942 (n's such that a(1..n) is a permutation of (1..n)). - Zak Seidov, Oct 19 2011
See also A076990, A243625.
See A282695 for deviation from identity sequence.
A073659 is a version where the partial sums must be primes.
KEYWORD
easy,nice,nonn
AUTHOR
Henry Bottomley, May 09 2000
EXTENSIONS
Corrected by Hans Havermann, Sep 24 2002
STATUS
approved
For any n >= 0, exactly four sums a(n+i) + a(n+j) are prime, for 0 <= i < j <= 3: lexicographically earliest such sequence of distinct nonnegative integers.
+10
22
0, 1, 2, 3, 4, 9, 8, 15, 14, 5, 26, 17, 6, 11, 12, 7, 30, 29, 24, 13, 18, 19, 10, 43, 28, 31, 16, 25, 22, 21, 46, 37, 52, 27, 34, 45, 44, 39, 58, 69, 20, 51, 32, 41, 38, 35, 48, 23, 36, 53, 50, 47, 54, 59, 42, 55, 72, 65, 84, 67, 114, 79, 60, 49, 78, 71, 102, 61, 66, 91, 40, 73, 76, 33, 64, 63, 68
OFFSET
0,3
COMMENTS
That is, there are exactly four primes (counted with multiplicity) among the 6 pairwise sums of any four consecutive terms. This is the theoretical maximum: there can't be a sequence with more than 4 prime sums in any 4 consecutive terms, see the wiki page for details.
This map is defined with offset 0 as to have a permutation of the nonnegative integers in case each of these eventually appears, which is so far only conjectured, see below. The restriction to positive indices would then be a permutation of the positive integers, and as it happens, also the smallest one with the given property. (This is in contrast to most other cases where that one is not the restriction of the other one: see crossrefs).
Concerning the existence of the sequence with infinite length: If the sequence is to be computed in a greedy manner, this means that for given P(n) := {a(n-1), a(n-2), a(n-3)} and thus 0 <= N(n) := #{ primes x + y with x, y in P(n), x < y} <= 4, we have to find a(n) such that we have exactly 4 - N(n) primes in a(n) + N(n). It is easy to prove that this is always possible when 4 - N(n) = 0 or 1. Otherwise, similar to A329452, ..., A329456, we see that P(n) is an "admissible constellation" in the sense that a(n-4) + P(n) already gave the number of primes required now. So a weaker variant of the k-tuple conjecture would ensure we can find this a(n). But the sequence need not be computable in greedy manner! That is, if ever for given P(n) no a(n) would exist such that a(n) + P(n) contains 4 - N(n) primes, this simply means that the considered value of a(n-1) (and possibly a(n-2)) was incorrect, and the next larger choice has to be made. Given this freedom, there is no doubt that this sequence is well defined up to infinity.
Concerning surjectivity: If a number m would never appear, this means that m + P(n) will never have the required number of 4 - N(n) primes for all n with a(n) > m, in spite of having found for each of these n at least two other solutions, a(n-4) + P(n) and a(n) + P(n) which both gave 4 - N(n) primes. This appears extremely unlikely and thus as strong evidence in favor of surjectivity.
See examples for further computational evidence.
LINKS
Eric Angelini, Prime sums from neighbouring terms, personal blog "Cinquante signes" (and post to the SeqFan list), Nov. 11, 2019.
M. F. Hasler, Prime sums from neighboring terms, OEIS Wiki, Nov. 23, 2019.
EXAMPLE
We start with a(0) = 0, a(1) = 1, a(2) = 2, a(3) = 3, the smallest possibilities which do not lead to a contradiction. Indeed, the four sums 0 + 2, 0 + 3, 1 + 2 and 2 + 3 are prime.
Now we have 2 prime sums using {1, 2, 3}, so the next term must give two more prime when added to these. We find that a(4) = 4 is the smallest possible choice, with 1 + 4 = 5 and 3 + 4 = 7.
Then there are again 2 primes among the pairwise sums using {2, 3, 4}, so the next term must again produce two more prime sums. We find that a(5) = 9 is the smallest possibility, with 2 + 9 = 11 and 4 + 9 = 13.
a(10^4) = 9834 and all numbers up to 9834 occurred by then.
a(10^5) = 99840 and all numbers below 99777 occurred by then.
a(10^6) = 1000144 and all numbers below 999402 occurred by then.
PROG
(PARI) A329449(n, show=0, o=0, N=4, M=3, p=[], U, u=o)={for(n=o, n-1, if(show>0, print1(o", "), show<0, listput(L, o)); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); for(k=u, oo, bittest(U, k-u) || min(c-#[0|p<-p, isprime(p+k)], #p>=M) || [o=k, break])); show&&print([u]); o} \\ Optional args: show=1: print a(o..n-1), show=-1: append a(o..n-1) to the global list L, in both cases print [least unused number] at the end; o=1: start with a(1)=1; N, M: get N primes using M+1 consecutive terms.
CROSSREFS
Other sequences with N primes among pairwise sums of M consecutive terms, starting with a(o) = o, sorted by decreasing N and lowest possible M: A329581 (N=11, M=8, o=0), A329580 (N=10, M=8, o=0), A329569 (N=9, M=6, o=0), A329568 (N=9, M=6, o=1), A329425 (N=6, M=5, o=0), A329449 (N=4, M=4, o=0), A329411 (N=2, M=3, o=0 or 1), A128280 (N=1, M=2, o=0), A055265 (N=1, M=2, o=1), A055266 (N=0, M=2; o=1), A253074 (N=0, M=2; o=0).
For other variants see A329333 (N=1, M=3; o=0/1), A329405 (0,3;1) .. A329417 (3,4;1), A329449 (4,4;0) .. A329580 (10,8;0).
KEYWORD
nonn
AUTHOR
M. F. Hasler, based on an idea from Eric Angelini, Nov 15 2019
STATUS
approved
a(n) + a(n+1) is never prime; lexicographically earliest such sequence of distinct positive integers.
+10
21
1, 3, 5, 4, 2, 6, 8, 7, 9, 11, 10, 12, 13, 14, 16, 17, 15, 18, 20, 19, 21, 23, 22, 24, 25, 26, 28, 27, 29, 31, 32, 30, 33, 35, 34, 36, 38, 37, 39, 41, 40, 42, 43, 44, 46, 45, 47, 48, 50, 49, 51, 53, 52, 54, 56, 55, 57, 58, 59, 60, 61, 62, 63, 65, 64, 66, 67, 68, 70, 71, 69, 72
OFFSET
1,2
COMMENTS
See A253074 for an essentially identical sequence (with a proof that the sequence is a permutation).
Sequence A253074 is defined in the same way, but starting with 0. This happens to produce the same sequence from the next term on. This is the case (M,N) = (2,0) in the family of sequences where M consecutive terms yield N primes in their pairwise sums, see the wiki page for other examples. - M. F. Hasler, Nov 26 2019
FORMULA
a(n) = A253074(n+1) (as long as A253074(1) = 0). - M. F. Hasler, Nov 26 2019
EXAMPLE
a(3) = 5 because 1 and 3 have already been used and both 3 + 2 = 5 and 3 + 4 = 7 are prime while 3 + 5 = 8 is not prime.
MAPLE
N:= 1000; # to get a[n] for n up to N
A:= {1};
a[1]:= 1;
for n from 2 to N do
mA:= max(A);
R:= {$1..mA} minus A;
for x in R do
if not isprime(a[n-1]+x) then
a[n]:= x;
break
fi
od:
if not assigned(a[n]) then
for x from mA+1 do
if not isprime(a[n-1]+x) then
a[n]:= x;
break
fi
od
fi;
A:= A union {x};
od:
seq(a[n], n=1..N); # Robert Israel, Jun 03 2014
MATHEMATICA
f[ s_ ]:=Block[ {k=1, a=s[ [ -1 ] ]}, While[ Or[ MemberQ[ s, k ], PrimeQ[ a+k ] ], k++ ]; Append[ s, k ] ]; Nest[ f, {1}, 121 ] (* Zak Seidov, Oct 21 2009 *)
a={1}; z=Range[2, 2002]; z=Complement[z, a]; While[Length[z]>1, If[!PrimeQ[z[[1]]+Last[a]], AppendTo[a, z[[1]]], If[!PrimeQ[z[[2]]+Last[a]], AppendTo[a, z[[2]]], AppendTo[a, z[[3]]]]]; z=Complement[z, a]]; Print[a] (* significantly faster *) (* Vladimir Joseph Stephan Orlovsky, May 03 2011 *)
PROG
(Haskell)
import Data.List (delete)
a055266 n = a055266_list !! (n-1)
a055266_list = 1 : f 1 [2..] where
f u vs = g vs where
g (w:ws) | a010051' (u + w) == 0 = w : f w (delete w vs)
| otherwise = g ws
-- Reinhard Zumkeller, Jan 14 2015
(PARI) v=[1]; n=1; while(n<100, if(!isprime(n+v[#v])&&!vecsearch(vecsort(v), n), v=concat(v, n); n=0); n++); v \\ Derek Orr, Jun 08 2015
(PARI) A055266_upto(n=99, u=1, U, a)={vector(n, n, n=u; while(bittest(U, n-u)|| isprime(a+n), n++); if(n>u, U+=1<<(n-u), U>>=-u+u+=valuation(U+2, 2)); a=n) + if(default(debug), print([u]))} \\ Optional args allow to tweak computation. If debug > 0, print least unused number at the end. - M. F. Hasler, Nov 25 2019
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Henry Bottomley, May 09 2000
EXTENSIONS
Corrected by Zak Seidov, Oct 21 2009
Name edited by M. F. Hasler, Nov 26 2019
STATUS
approved
Among the pairwise sums of any three consecutive terms there are exactly two prime sums: lexicographically earliest such sequence of distinct positive numbers.
+10
17
1, 2, 3, 4, 7, 6, 5, 8, 9, 10, 13, 16, 15, 14, 17, 12, 11, 18, 19, 22, 21, 20, 23, 24, 29, 30, 31, 28, 25, 33, 34, 26, 27, 32, 35, 36, 37, 42, 41, 38, 45, 44, 39, 40, 43, 46, 51, 50, 47, 53, 54, 48, 49, 52, 55, 57, 82, 56, 75, 62, 64, 87, 63, 76, 61, 66, 65, 71, 86, 60, 77, 67, 72, 59, 68, 69, 58, 70
OFFSET
1,2
COMMENTS
About existence of this (infinite) sequence: If it is computed in greedy manner, this means that for given n we are given P(n) := {a(n-1), a(n-2)} and have to find a(n) such that we have exactly 1 or 2 primes in a(n) + P(n) depending on whether a(n-1) + a(n-2) is prime or not. It is easy to prove that this is always possible in the first case (1 prime required). In the second case, we must find two larger primes at given distance |a(n-1) - a(n-2)|, necessarily even, since a(n-3) + P(n) contains two primes. To have this infinitely many times, the twin prime conjecture or a variant thereof must hold. However, the sequence need not be computable in greedy manner! That is, if ever for given P(n) (with composite sum) no a(n) would exist such that a(n) + P(n) contains 2 primes, this simply means that the considered value of a(n-1) was incorrect, and the next larger choice has to be made. Given this freedom, there is no doubt about well-definedness of this sequence up to infinity. - M. F. Hasler, Nov 14 2019, edited Nov 16 2019
Could be extended to a(0) = 0 to yield a sequence of nonnegative integers with the same property, including lexicographic minimality, which is a permutation of the nonnegative integers iff this sequence is a permutation of the positive integers.
This is the first known example where the restriction of S(N,M;0) to [1..oo) gives S(N,M;1), where S(N,M;o) is the lexicographically smallest sequence with a(o)=o, N primes among pairwise sums of M consecutive terms, and no duplicate terms: For example, S(0,3;1) = A329405 is not A329450\{0}, S(2,4;1) = A329412 is not A329452\{0}, etc. The second such example is S(4,4;o) = A329449. - M. F. Hasler, Nov 16 2019
Differs from A055265 from a(30) = 33 on. See the wiki page for further considerations and variants. - M. F. Hasler, Nov 24 2019
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
a(1) = 1 is the smallest possible choice; there's no restriction on the first term.
a(2) = 2 as 2 is the smallest available integer not leading to a contradiction. Note that as 1 + 2 = 3 we already have one prime sum (out of the required two) with the pair {1, 2}.
a(3) = 3 as 3 is the smallest available integer not leading to a contradiction. Since 2 + 3 = 5 we now have our two prime sums with the triplet {1, 2, 3}.
a(4) = 4 as 4 is the smallest available integer not leading to a contradiction. Since 3 + 4 = 7 we now have our two prime sums with the triplet {2, 3, 4}: they are 2 + 3 = 5 and 3 + 4 = 7.
a(5) = 7 because 5 or 6 would lead to a contradiction: indeed, both the triplets {3, 4, 5} and {3, 4, 6} will produce only one prime sum (instead of two). With a(5) = 7 we have the triplet {3, 4, 7} and the two prime sums we were looking for: 3 + 4 = 7 and 4 + 7 = 11.
And so on.
MATHEMATICA
a[1]=1; a[2]=2; a[n_]:=a[n]=(k=1; While[Length@Select[Plus@@@Subsets[{a[n-1], a[n-2], ++k}, {2}], PrimeQ]!=2||MemberQ[Array[a, n-1], k]]; k); Array[a, 100] (* Giorgos Kalogeropoulos, May 09 2021 *)
PROG
(PARI) A329411(n, show=0, o=1, N=2, M=2, p=[], U, u=o)={for(n=o, n-1, show>0&& print1(o", "); show<0&& listput(L, o); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); for(k=u, oo, bittest(U, k-u)|| min(c-#[0|p<-p, isprime(p+k)], #p>=M) ||[o=k, break])); show&&print([u]); o} \\ Optional args: show=1: print a(o..n-1), show=-1: append a(o..n-1) to the (global) list L, in both cases print [least unused number] at the end; o=0: start with a(o)=o; N, M: find N primes using M+1 consecutive terms. - M. F. Hasler, Nov 16 2019
CROSSREFS
Cf. A055265 (sum of two consecutive terms is always prime: differs from a(30) on).
Cf. A329412 .. A329416 (exactly 2 prime sums using 4, ..., 10 consecutive terms).
Cf. A329333, A329406 .. A329410 (exactly 1 prime sum using 3, 4, ..., 10 consecutive terms).
Cf. A055266 (no prime sum among 2 consecutive terms), A329405 (no prime among the pairwise sums of 3 consecutive terms).
See also "nonnegative" variants: A253074, A329450 (0 primes using 2 resp. 3 terms), A128280 (1 prime from 2 terms), A329452, A329453 (2 primes from 4 resp. 5 terms), A329454, A329455 (3 primes from 4 resp. 5 terms), A329449, A329456 (4 primes from 4 resp. 5 terms). See the Wiki page for more.
KEYWORD
nonn
AUTHOR
STATUS
approved
Lexicographically earliest sequence of distinct numbers such that no sum of consecutive terms is prime.
+10
14
0, 1, 8, 6, 10, 14, 12, 4, 20, 16, 24, 18, 22, 28, 26, 34, 30, 32, 36, 40, 42, 46, 38, 44, 52, 48, 54, 50, 58, 56, 62, 64, 60, 66, 68, 72, 70, 74, 80, 76, 78, 86, 82, 84, 90, 92, 94, 88, 98, 96, 104, 100, 102, 108, 110, 112, 114, 106, 116, 122, 118, 120, 124, 126, 130, 132, 134, 128, 138, 136, 142, 140, 144, 146, 148, 150, 154, 152, 156, 158
OFFSET
0,3
COMMENTS
In other words, no sum a(i)+a(i+1)+a(i+2)+...+a(n) may be prime. In particular, the sequence may not contain any primes.
I conjecture that the sequence contains all even numbers > 2 and no odd number beyond 1. If so, we must simply ensure that the sum a(1)+...+a(n) is not prime, which is always possible for one of the three consecutive even numbers {2n, 2n+2, 2n+4}. As a consequence, it would follow that a(n) ~ 2n.
Is there even a proof that the smallest odd composite number, 9, does not appear?
The variant A254341 has the additional restriction of alternating parity, which avoids excluding the odd numbers.
The least odd composite number a'(n+1) that could occur as the next term after a(n) and such that sum(a(i),i=k...n)+a'(n+1) is composite for all k <= n is (for n = 0, 1, 2,...): 9, 9, 25, 21, 39, 25, 69, 65, 45, 119, 95, 77, 55, 27, 595, 561, 531, 865, 1519, 1479, 1437, 1391, 1353, 1309, 1257, 1209, 1155, 1105, 1047, 2317, 2255, 2191, 3565, 5719, 13067, 12995, 12925, 12851, 12771, 12695, 12617, 12531, 12449, 12365, 12275, ... The growth of this sequence shows how it is increasingly unlikely that an odd number could occur, since the next possible even term is only about 2n.
LINKS
Robert G. Wilson v and M. F. Hasler, Table of n, a(n) for n = 0..5000 (terms 0..999 from M. F. Hasler)
FORMULA
It appears that a(n) ~ 2n.
EXAMPLE
To explain the beginning of the sequence, observe that starting with the smallest possible terms 0, 1 does not appear to lead to a contradiction (and in fact never does), so we start there.
The next composite would be 4 but 1+4=5 is prime, as is 1+6, but 1+8=9 is not, so we take a(2) = 8 to be the next term.
4 is impossible for a(3) since 1+8+4=13 is prime, but neither 1+8+6=15 nor 8+6 is prime, so a(3)=6.
MATHEMATICA
f[lst_List] := Block[{k = 1}, While[ PrimeQ@ k || MemberQ[lst, k] || Union@ PrimeQ@ Accumulate@ Reverse@ Join[lst, {k}] != {False}, k++]; Append[lst, k]]; Nest[f, {0}, 70] (* Robert G. Wilson v, Jan 31 2015 *)
PROG
(PARI) a=[]; u=0; for(i=1, 99, a=concat(a, 0); until( ! isprime(s) || ! a[i]++, while( isprime(a[i]) || bittest(u, a[i]), a[i]++); s=a[k=i]; while( k>1 && ! isprime( s+=a[k--]), )); u+=2^a[i]; print1(a[i]", "))
CROSSREFS
Cf. A025044 (no pairwise sum is prime), A025043 (no pairwise difference is prime).
KEYWORD
nonn,nice
AUTHOR
M. F. Hasler, Jan 28 2015
STATUS
approved
For all n >= 0, exactly six sums are prime among a(n+i) + a(n+j), 0 <= i < j < 6; lexicographically earliest such sequence of distinct nonnegative numbers.
+10
10
0, 1, 2, 3, 4, 24, 5, 7, 6, 8, 9, 10, 11, 13, 18, 19, 16, 12, 28, 31, 17, 15, 14, 22, 26, 20, 21, 27, 23, 30, 32, 80, 41, 38, 51, 39, 62, 29, 35, 44, 34, 45, 54, 25, 49, 33, 64, 36, 37, 40, 46, 61, 47, 42, 43, 55, 66, 58, 65, 48, 72, 79, 52, 53, 59, 78, 50, 57, 60, 89, 71, 56, 68, 63, 74, 75, 76, 69, 82, 81, 67, 91, 88, 70, 100
OFFSET
0,3
COMMENTS
That is, there are 6 primes, counted with multiplicity, among the 15 pairwise sums of any 6 consecutive terms.
Is this a permutation of the nonnegative integers?
If so, then the restriction to [1..oo) is a permutation of the positive integers, but not the lexicographically earliest one with this property, which starts (1, 2, 3, 4, 5, 7, 6, 8, 9, 10, 11, 13, 18, 19, 16, 12, 24, ...).
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
For n = 0, we consider pairwise sums of the first 6 terms a(0..5) = (0, 1, 2, 3, 4, 24): We have (a(i) + a(j), 0 <= i < j < 6) = (1; 2, 3; 3, 4, 5; 4, 5, 6, 7; 24, 25, 26, 27, 28) among which there are 6 primes, counted with repetition. This justifies taking a(0..4) = (0, ..., 4), the smallest possible choices for these first 5 terms. Since no smaller a(5) between 5 and 23 has this property, this is the start of the lexicographically earliest nonnegative sequence with this property and no duplicate terms.
Then we find that a(6) = 5 is possible, also giving 6 prime sums for n = 1, so this is the correct continuation (modulo later confirmation that the sequence can be continued without contradiction given this choice).
Next we find that a(7) = 6 is not possible, it would give only 5 prime sums using the 6 consecutive terms (2, 3, 4, 24, 5, 6). However, a(7) = 7 is a valid continuation, and so on.
PROG
(PARI) A329566(n, show=0, o=0, N=6, M=5, p=[], U, u=o)={for(n=o, n-1, if(show>0, print1(o", "), show<0, listput(L, o)); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); if(#p<M&&sum(i=1, #p, isprime(p[i]+u))<=c, o=u)|| for(k=u, oo, bittest(U, k-u)|| sum(i=1, #p, isprime(p[i]+k))!=c||[o=k, break])); show&&print([u]); o} \\ optional args: show=1: print a(o..n-1), show=-1: append them on global list L, in both cases print [least unused number] at the end; o=1: start at a(1)=1; N, M: find N primes using M+1 terms. See the wiki page for a function S() which returns a vector: a(0..n-1) = S(n, 6, 6).
CROSSREFS
Cf. A329425 (6 primes using 5 consecutive terms).
Cf. A329449 (4 primes using 4 consecutive terms), A329456 (4 primes using 5 consecutive terms).
Cf. A329454 (3 primes using 4 consecutive terms), A329455 (3 primes using 5 consecutive terms).
Cf. A329411 (2 primes using 3 consecutive terms), A329452 (2 primes using 4 consecutive terms), A329453 (2 primes using 5 consecutive terms).
Cf. A329333 (1 (odd) prime using 3 terms), A128280 & A055265 (1 prime using 2 terms); A055266 & A253074 (0 primes using 2 terms), A329405 & A329450 (0 primes using 3 terms), A329406 ff: other variants.
KEYWORD
nonn
AUTHOR
M. F. Hasler, Nov 17 2019
STATUS
approved
For all n >= 1, exactly five sums are prime among a(n+i) + a(n+j), 0 <= i < j < 5; lexicographically earliest such sequence of distinct positive numbers.
+10
6
1, 2, 3, 4, 5, 8, 9, 14, 6, 23, 17, 7, 12, 24, 10, 13, 19, 16, 18, 25, 22, 15, 28, 21, 26, 32, 75, 20, 11, 27, 56, 30, 41, 53, 29, 38, 60, 44, 35, 113, 36, 31, 48, 61, 37, 42, 46, 33, 34, 55, 39, 40, 49, 58, 45, 43, 52, 51, 106, 57, 62, 50, 87, 47, 54, 59, 80, 66, 83, 68
OFFSET
1,2
COMMENTS
That is, there are 5 primes, counted with multiplicity, among the 10 pairwise sums of any 5 consecutive terms.
Conjectured to be a permutation of the positive integers.
This sequence is quite different from the restriction of the "nonnegative" variant A329564 to positive indices: it seems that the two have no common terms beyond a(6) = 8, except for the accidental a(22) = 15 and maybe some later coincidences of this type. There also appears to be no other simple relation between the terms of these sequences, in contrast to, e.g., A055265 vs. A128280.
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
For n = 1, we consider pairwise sums among the first 5 terms chosen as small as possible, a(1..5) = (1, 2, 3, 4, 5). We see that we have indeed 5 primes among the sums 1+2, 1+3, 1+4, 1+5, 2+3, 2+4, 2+5, 3+4, 3+5, 4+5.
Then, to get a(6), consider first the pairwise sums among terms a(2..5), (2+3, 2+4, 2+5; 3+4, 3+5; 4+5), among which there are 3 primes, counted with multiplicity (i.e., the prime 7 is there two times). So the new term a(6) must give exactly two more prime sums with the terms a(2..5). We find that 6 or 7 would give just one more (5+6 resp. 4+7), but a(6) = 8 gives exactly two more, 3+8 and 5+8.
PROG
(PARI) {A329563(n, show=1, o=1, N=5, M=4, p=[], u=o, U)=for(n=o, n-1, show>0&& print1(o", "); show<0&& listput(L, o); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); if(#p<M&&sum(i=1, #p, isprime(p[i]+u))<=c, o=u)|| for(k=u, oo, bittest(U, k-u)|| sum(i=1, #p, isprime(p[i]+k))!=c|| [o=k, break])); show&&print([u]); o} \\ optional args: show=1: print a(o..n-1), show=-1: append them on global list L, in both cases print [least unused number] at the end. See the wiki page for a function S() which returns a vector: a(0..n-1) = S(5, 5; 1).
CROSSREFS
Cf. A329425 (6 primes using 5 consecutive terms), A329566 (6 primes using 6 consecutive terms).
Cf. A329449 (4 primes using 4 consecutive terms), A329456 (4 primes using 5 consecutive terms).
Cf. A329454 (3 primes using 4 consecutive terms), A329455 (3 primes using 5 consecutive terms).
Cf. A329411 (2 primes using 3 consecutive terms), A329452 (2 primes using 4 consecutive terms), A329453 (2 primes using 5 consecutive terms).
Cf. A329333 (1 (odd) prime using 3 terms), A128280 & A055265 (1 prime using 2 terms); A055266 & A253074 (0 primes using 2 terms), A329405 & A329450 (0 primes using 3 terms), A329406 ff: other variants.
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 09 2020
STATUS
approved
Lexicographically earliest sequence of distinct numbers such that neither a(n) nor a(n-1)+a(n) is prime.
+10
3
0, 1, 8, 4, 6, 9, 12, 10, 14, 16, 18, 15, 20, 22, 24, 21, 25, 26, 28, 27, 30, 32, 33, 35, 34, 36, 38, 39, 42, 40, 44, 46, 45, 48, 50, 49, 51, 54, 52, 56, 55, 57, 58, 60, 62, 63, 65, 64, 66, 68, 70, 72, 69, 74, 76, 77, 75, 78, 80, 81, 84, 82, 86, 85, 87, 88
OFFSET
1,3
COMMENTS
Conjecture: this is a permutation of the nonprimes. [Proof outline given below by Semeon Artamonov and Pat Devlin.]
Let x be a number that's missing.
Then eventually every term must be of the form PRIME - x. (Otherwise, x would appear as that next term.)
In particular, this means there are only finitely many multiples of x that appear in the sequence. To make this cleaner, let Y be a multiple of x larger than all multiples of x appearing in the sequence.
Let q be a prime not dividing Y. Then since none of the terms Y, 2Y, 3Y, ..., 2qY appear, it must be that, eventually, every term in the sequence is of the form PRIME - Y and also of the form PRIME - 2Y and also of the form PRIME - 3Y, ... and also of the form PRIME - 2qY.
That means we have a prime p and a number Y such that p, p+Y, p+2Y, p + 3Y, p+4Y, ..., p+2qY are all prime. But take this sequence mod q. Since q does not divide Y, the terms 0, Y, ..., 2qY cover every residue class mod q twice. Therefore, p + kY covers each residue class mod q twice. Consequently, there are two terms congruent to 0 mod q. One can be q, but the other must be a multiple of it (contradicting its primality).
LINKS
PROG
(Haskell)
a253073 n = a253073_list !! (n-1)
a253073_list = 0 : f 0 a018252_list where
f u vs = g vs where
g (w:ws) | a010051' (u + w) == 1 = g ws
| otherwise = w : f w (delete w vs)
-- Reinhard Zumkeller, Feb 02 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Feb 01 2015, based on a suggestion from Patrick Devlin
STATUS
approved
For all n >= 0, exactly 12 sums are prime among a(n+i) + a(n+j), 0 <= i < j < 7; lexicographically earliest such sequence of distinct nonnegative numbers.
+10
3
0, 1, 2, 5, 6, 11, 12, 17, 26, 35, 36, 47, 24, 54, 77, 7, 43, 60, 13, 30, 96, 4, 67, 97, 16, 133, 34, 3, 40, 27, 63, 100, 10, 20, 171, 9, 8, 51, 21, 22, 52, 15, 32, 38, 75, 141, 56, 41, 71, 122, 152, 45, 68, 29, 59, 14, 39, 44, 50, 23, 53, 57, 74, 107, 170, 176, 93, 134, 137, 86, 177, 65, 476, 62, 87, 92, 101
OFFSET
0,3
COMMENTS
That is, there are 12 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
This is the theoretical maximum: there can't be more than 12 primes in pairwise sums of 7 distinct numbers > 1. See the wiki page for more details.
Conjectured to be a permutation of the nonnegative integers. See A329573 for the "positive" variant: same definition but with offset 1 and positive terms, leading to a quite different sequence.
For a(3) and a(4) resp. a(5) one must forbid the values < 5 resp. < 11 which would be the greedy choices, in order to get a solution for a(7), but from then on, the greedy choice gives the correct solution, at least for several hundred terms.
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
PROG
(PARI) {A329572(n, show=0, o=0, N=12, M=6, D=[3, 5, 4, 6, 5, 11], p=[], u=o, U)=for(n=o+1, n, show>0&& print1(o", "); show<0&& listput(L, o); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); D&& D[1]==n&& [o=D[2], D=D[3..-1]]&& next; my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); for(k=u, oo, bittest(U, k-u)|| min(c-#[0|p<-p, isprime(p+k)], #p>=M)|| [o=k, break])); show&&print([u]); o} \\ optional args: show=1: print a(o..n-1), show=-1: append them on global list L, in both cases print [least unused number] at the end. See the wiki page for more.
CROSSREFS
Cf. A055273 (analog starting with a(1) = 1), A055265 & A128280 (1 prime using 2 terms), A055266 & A253074 (0 primes using 2 terms), A329405 - A329416, A329425, A329333, A329449 - A329456, A329563 - A329581.
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 09 2020
STATUS
approved
For all n >= 1, exactly 12 sums are prime among a(n+i) + a(n+j), 0 <= i < j < 7; lexicographically earliest such sequence of distinct positive numbers.
+10
3
1, 2, 3, 4, 9, 10, 27, 14, 20, 33, 34, 69, 39, 28, 40, 13, 19, 70, 31, 43, 180, 220, 61, 36, 66, 91, 127, 7, 12, 5, 102, 186, 11, 6, 25, 18, 55, 41, 42, 48, 65, 72, 59, 38, 125, 24, 29, 35, 54, 32, 47, 77, 164, 26, 407, 15, 116, 63, 75, 404, 416, 8, 215, 45, 56, 183, 23, 134, 206, 17, 44, 50
OFFSET
1,2
COMMENTS
That is, there are 12 primes, counted with multiplicity, among the 21 pairwise sums of any 7 consecutive terms.
This is the theoretical maximum: there can't be more than 12 primes in pairwise sums of 7 distinct numbers > 1. See the wiki page for more details.
Conjectured to be a permutation of the positive integers. See A329572 for the nonnegative variant (same definition but with n >= 0 and terms >= 0), leading to a quite different sequence.
For a(5) and a(6) one must forbid values up to 8 in order to be able to find a solution for a(7), but from then on, the greedy choice gives the correct solution, at least for several hundred terms. Small values appearing late are a(30) = 5, a(34) = 6, a(28) = 7, a(62) = 8.
LINKS
M. F. Hasler, Prime sums from neighboring terms, OEIS wiki, Nov. 23, 2019
EXAMPLE
Up to and including the 6th term, there is no constraint other than not using a term more than once, since it is impossible to have more than 12 primes as pairwise sums of 6 numbers. So one would first try to use the lexicographically smallest possible choice a(1..6) =?= (1, 2, ..., 6). But then one would have only 7 pairs (i,j) such that a(i) + a(j) is prime, 1 <= i < j <= 6. So one would need 12 - 7 = 5 more primes in {1, 2, ..., 6} + a(7), which is impossible. One can check that even a(1..5) =?= (1,...,5) does not allow one to find a(6) and a(7) in order to have 12 prime sums a(i) + a(j), 1 <= i < j <= 7. Nor is it possible to find a solution with a(5) equal to 6 or 7 or 8. One finds that a(5) = 9, and a(6) = 10, are the smallest possible choices for which a(7) can be found as to satisfy the requirement. In that case, a(7) = 27 is the smallest possible solution, which yields the 12 prime sums 1+2, 2+3, 1+4, 3+4, 2+9, 4+9, 1+10, 3+10, 9+10, 2+27, 4+27, 10+27.
Now, to satisfy the definition of the sequence for n = 2, we drop the initial 1 from the set of consecutive terms, and search for a(8) producing the same number of additional primes together with {2, 3, 4, 9, 10, 27} as did a(1) = 1, namely 3. We see that a(8) = 14 is the smallest possibility. And so on.
It seems that once a(5) and a(6) are chosen, one may always take the smallest possible choice for the next term without ever again running into difficulty. This is in strong contrast to the (exceptional) case of the variant where we require 10 prime sums among 7 consecutive terms, cf. sequence A329574.
PROG
(PARI) {A329573(n, show=0, o=1, N=12, M=6, D=[5, 9, 6, 10], p=[], u=o, U)=for(n=o+1, n, show>0&& print1(o", "); show<0&& listput(L, o); U+=1<<(o-u); U>>=-u+u+=valuation(U+1, 2); p=concat(if(#p>=M, p[^1], p), o); D&& D[1]==n&& [o=D[2], D=D[3..-1]]&& next; my(c=N-sum(i=2, #p, sum(j=1, i-1, isprime(p[i]+p[j])))); for(k=u, oo, bittest(U, k-u)|| min(c-#[0|p<-p, isprime(p+k)], #p>=M)|| [o=k, break])); show&&print([u]); o} \\ optional args: show=1: print a(o..n-1), show=-1: append them on global list L, in both cases print [least unused number] at the end. See the wiki page for more.
CROSSREFS
Cf. A055272 (analog starting with a(0)=0), A055265 & A128280 (1 prime using 2 terms), A055266 & A253074 (0 primes using 2 terms), A329405 - A329416, A329425, A329333, A329449 - A329456, A329563 - A329581.
KEYWORD
nonn
AUTHOR
M. F. Hasler, Feb 09 2020
STATUS
approved

Search completed in 0.013 seconds