A121862
Least previously nonoccurring positive integer such that partial sum + 2 is prime.
Original entry on oeis.org
1, 2, 6, 8, 4, 14, 10, 12, 20, 18, 16, 24, 26, 28, 32, 34, 36, 38, 22, 30, 48, 56, 54, 46, 44, 42, 60, 40, 50, 58, 66, 62, 52, 68, 64, 84, 90, 72, 92, 70, 96, 80, 94, 78, 104, 76, 74, 106, 102, 110, 88, 98, 82, 108, 114, 126, 116, 118, 86, 100, 120, 144, 122, 130, 128, 136
Offset: 1
a(1) = 1 because 1+2 = 3 is prime.
a(2) = 2 because 1+2+2 = 5 is prime.
a(3) = 6 because 1+2+6+2 = 11 is prime.
a(4) = 8 because 1+2+6+8+2 = 19 is prime.
a(5) = 4 because 1+2+6+8+4+2 = 23 is prime.
-
M:= 300: # to get all entries before the first entry > N
a[1]:= 1:
s:= 3:
R:= {seq(2*i,i=1..M/2)}:
found:= true:
for n from 2 while found do
found:= false;
for r in R do
if isprime(s+r) then
a[n]:= r;
s:= s + r;
R:= R minus {r};
found:= true;
break
fi
od:
od:
seq(a[i],i=1..n-2); # Robert Israel, Feb 10 2015
-
f[s_] := Append[s, k = 1; p = 2 + Plus @@ s; While[MemberQ[s, k] || ! PrimeQ[p + k], k++ ]; k]; Nest[f, {}, 67] (* Robert G. Wilson v, Aug 31 2006 *)
A122866
Consider the array of sequences defined to be "the least previously nonoccurring positive integer such that partial sum + k is prime" beginning with k=0. This sequence is the main diagonal of that array.
Original entry on oeis.org
2, 3, 6, 4, 12, 10, 16, 12, 16, 24, 26, 24, 30, 28, 28, 44, 36, 42, 20, 38, 34, 54, 54, 56, 48, 44, 50, 52, 68, 56, 56, 60, 62, 66, 66, 70, 76, 84, 76, 58, 92, 90, 88, 90, 80, 88, 92, 102, 104, 102, 114, 104, 108, 98, 114, 108, 92, 100, 120, 126, 124, 130, 126, 142, 116, 126
Offset: 0
The array of sequences begins
k= 0: 2, 1, 4, 6, 10, 8, 12, 16, 14, 24, 30, 22, 18, 26, 34, ...,.
k= 1: 1, 3, 2, 4, 6, 12, 8, 10, 14, 18, 22, 26, 24, 16, 30, ...,.
k= 2: 1, 2, 6, 8, 4, 14, 10, 12, 20, 18, 16, 24, 26, 28, 32, ...,.
k= 3: 2, 6, 8, 4, 14, 10, 12, 20, 18, 16, 24, 26, 28, 32, 34, ...,.
k= 4: 1, 2, 4, 6, 12, 8, 10, 14, 18, 22, 26, 24, 16, 30, 32, ...,.
k= 5: 2, 4, 6, 12, 8, 10, 14, 18, 22, 26, 24, 16, 30, 32, 28, ...,.
-
f[s_] := Append[s, k = 1; p = q + Plus @@ s; While[MemberQ[s, k] || !PrimeQ[p + k], k++ ]; k]; T[n_, k_] := Nest[q = k; f, {}, n][[ -1]]; Table[T[n, n - 1], {n, 66}]
A122867
Consider the array of sequences defined to be "the least previously nonoccurring positive integer such that partial sum + k is prime" beginning with k=0. This sequence is that array read by successive antidiagonals.
Original entry on oeis.org
2, 1, 1, 1, 3, 4, 2, 2, 2, 6, 1, 6, 6, 4, 10, 2, 2, 8, 8, 6, 8, 1, 4, 4, 4, 4, 12, 12, 4, 4, 6, 6, 14, 14, 8, 16, 3, 2, 2, 12, 12, 10, 10, 10, 14, 2, 2, 6, 6, 8, 8, 12, 12, 14, 24, 1, 6, 4, 10, 10, 10, 10, 20, 20, 18, 30, 2, 2, 12, 6, 8, 8, 14, 14, 18, 18, 22, 22, 1, 4, 4, 8, 8, 16, 16, 18, 18, 16
Offset: 1
The array of sequences begins
k= 0: 2, 1, 4, 6, 10, 8, 12, 16, 14, 24, 30, 22, 18, 26, 34, ...,.
k= 1: 1, 3, 2, 4, 6, 12, 8, 10, 14, 18, 22, 26, 24, 16, 30, ...,.
k= 2: 1, 2, 6, 8, 4, 14, 10, 12, 20, 18, 16, 24, 26, 28, 32, ...,.
k= 3: 2, 6, 8, 4, 14, 10, 12, 20, 18, 16, 24, 26, 28, 32, 34, ...,.
k= 4: 1, 2, 4, 6, 12, 8, 10, 14, 18, 22, 26, 24, 16, 30, 32, ...,.
k= 5: 2, 4, 6, 12, 8, 10, 14, 18, 22, 26, 24, 16, 30, 32, 28, ...,.
-
f[s_] := Append[s, k = 1; p = q + Plus @@ s; While[MemberQ[s, k] || !PrimeQ[p + k], k++ ]; k]; T[n_, k_] := Nest[q = k; f, {}, n][[ -1]]; Table[T[k, n - k], {n, 13}, {k, n}] // Flatten
Showing 1-3 of 3 results.
Comments