Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Search: a115316 -id:a115316
     Sort: relevance | references | number | modified | created      Format: long | short | data
Inverse of A115316.
+20
3
1, 2, 5, 3, 8, 4, 11, 6, 7, 9, 14, 10, 17, 12, 13, 15, 20, 16, 23, 18, 19, 21, 26, 22, 24, 25, 27, 28, 29, 30, 32, 31, 33, 34, 36, 37, 35, 39, 40, 42, 38, 43, 41, 45, 46, 48, 44, 49, 51, 52, 54, 55, 47, 57, 58, 60, 61, 63, 50, 64, 53, 66, 67, 69, 70, 72, 56, 73, 75, 76, 59, 78
OFFSET
1,2
FORMULA
a(a(n)) = A115319(n).
a(n) = A115316(A115319(n)) = A115319(A115316(n)).
MATHEMATICA
nmax = 72;
nn = nmax + 10; (* estimated length of A115316 - should be increased in case of message "NotFound" in the output *)
np = Ceiling[nn/3] + 1;
nc = Ceiling[(2/3) nn];
pp = Prime[Range[np]];
cc = Partition[Select[Range[FindRoot[n == nc + PrimePi[n] + 1, {n, nc, 2nc}][[1, 2]] // Floor], CompositeQ], 2];
A115316 = Join[{1}, Riffle[pp, cc] // Flatten][[1 ;; nn]];
a[n_] := FirstPosition[A115316, n][[1]];
Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, Nov 15 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 20 2006
STATUS
approved
a(n) = A115316(A115316(n)).
+20
2
1, 2, 6, 8, 4, 5, 10, 3, 12, 14, 9, 11, 16, 7, 18, 20, 15, 17, 22, 13, 24, 25, 21, 26, 23, 19, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 35, 43, 41, 38, 42, 39, 40, 53, 47, 44, 61, 45, 46, 71, 48, 59, 57, 49, 50, 63, 51, 52, 89, 67, 54, 68, 55, 56, 74, 73, 58, 107, 60, 79, 113, 62
OFFSET
1,2
COMMENTS
Inverse integer permutation of A115319;
A115318(a(n)) = a(A115318(n)) = A115316(n).
MATHEMATICA
nmax = 72; (* length of this sequence *)
nn = nmax + 20 (* estimated length of A115316 - should be increased if insufficient *);
np = Ceiling[nn/3] + 1;
nc = Ceiling[(2/3) nn];
pp = Prime[Range[np]];
cc = Partition[Select[Range[FindRoot[n == nc + PrimePi[n] + 1, {n, nc, 2nc}][[1, 2]] // Floor], CompositeQ], 2];
A115316 = Join[{1}, Riffle[pp, cc] // Flatten][[1 ;; nn]];
a[n_] := A115316[[A115316[[n]]]];
Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, Nov 15 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 20 2006
STATUS
approved
a(n) = A115318(A115318(n)).
+10
3
1, 2, 8, 5, 6, 3, 14, 4, 11, 7, 12, 9, 20, 10, 17, 13, 18, 15, 26, 16, 23, 19, 25, 21, 22, 24, 27, 28, 29, 30, 31, 32, 33, 34, 37, 35, 36, 40, 42, 43, 39, 41, 38, 46, 48, 49, 45, 51, 54, 55, 57, 58, 44, 61, 63, 64, 53, 67, 52, 69, 47, 72, 56, 75, 76, 78, 60, 62, 81, 82, 50, 85
OFFSET
1,2
COMMENTS
Inverse integer permutation of A115317.
FORMULA
A115316(a(n)) = a(A115316(n)) = A115318(n).
MATHEMATICA
nmax = 72;
nn = nmax + 15; (* estimated length of A115316 - should be increased in case of message "NotFound" in the output *)
np = Ceiling[nn/3] + 1;
nc = Ceiling[(2/3) nn];
pp = Prime[Range[np]];
cc = Partition[Select[Range[FindRoot[n == nc + PrimePi[n] + 1, {n, nc, 2nc}][[1, 2]] // Floor], CompositeQ], 2];
A115316 = Join[{1}, Riffle[pp, cc] // Flatten][[1 ;; nn]];
A115318[n_] := FirstPosition[A115316, n][[1]];
a[n_] := A115318[A115318[n]];
Table[a[n], {n, 1, nmax}] (* Jean-François Alcover, Nov 15 2021 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jan 20 2006
STATUS
approved
Lexicographically earliest permutation of the natural numbers such that primes and composites alternate in the sums of adjacent terms.
+10
3
1, 2, 4, 3, 5, 6, 8, 9, 7, 10, 11, 12, 13, 16, 14, 15, 17, 20, 18, 19, 21, 22, 23, 24, 25, 28, 26, 27, 29, 30, 32, 35, 31, 36, 33, 34, 38, 41, 37, 42, 39, 40, 44, 45, 43, 46, 47, 50, 48, 49, 51, 52, 53, 54, 56, 57, 55, 58, 59, 68, 60, 67, 61, 66, 62, 65, 63
OFFSET
1,2
COMMENTS
For k > 0: a(2*k-1) + a(2*k) is prime, a(2*k) + a(2*k+1) is composite.
FORMULA
A010051(a(n)+a(n+1)) = n mod 2.
EXAMPLE
. n | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
. a(n) | 1 2 4 3 5 6 8 9 7 10 11 12 13 16 14 15 17 20 18 19
. A026233(a(n)) | 1 1 2 2 3 3 4 5 4 6 5 7 6 10 8 9 7 12 11 8 .
PROG
(Haskell)
import Data.List (delete)
a244724 n = a244724_list !! (n-1)
a244724_list = 1 : f 1 [2..] where
f x xs = f' xs where
f' (u:us) | a010051' (x + u) == 1 = g u (delete u xs)
| otherwise = f' us where
g y ys = g' ys where
g' (v:vs) | a010051' (y + v) == 0 = u : v : f v (delete v ys)
| otherwise = g' vs
CROSSREFS
Cf. A244732 (inverse), A244731 (fixed points), A073846, A113321, A115316.
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jul 05 2014
STATUS
approved
Repeat: Take next nonprime, next prime, next nonprime, then reverse the order.
+10
0
4, 2, 1, 8, 3, 6, 10, 5, 9, 14, 7, 12, 16, 11, 15, 20, 13, 18, 22, 17, 21, 25, 19, 24, 27, 23, 26, 30, 29, 28, 33, 31, 32, 35, 37, 34, 38, 41, 36, 40, 43, 39, 44, 47, 42, 46, 45, 53, 49, 48, 59, 51, 50, 61, 54, 52, 67, 56, 55, 71
OFFSET
1,1
COMMENTS
Start with first nonprime 1 and first prime 2. To obtain the first three terms take first nonprime 1, first prime 2, next nonprime 4, then reverse the order to get 4, 2, 1. Next step: take next nonprime 6, next prime 3, next nonprime 8 and reverse to get 8, 3, 6. It is obvious that the sequence is a permutation of positive integers. It is closely related to the lexicographically earliest permutation of the natural numbers such that each prime number is followed by exactly two composite numbers (cf. A115316). It is also related in a certain way to the number of primes <= n, PrimePi(n) (cf. A000720).
Conjecture: The permutation has exactly 12 fixed points: 2, 6, 9, 12, 15, 18, 21, 24, 29, 40, 46, 49.
From D. S. McNeil, Dec 09 2010: (Start)
The conjecture is true, roughly because the primes are packed far too closely (one every three terms, after all) and as a result the nonprimes are too spread out.
First consider the primes: after permutation the k-th prime p shows up at 3*k-1, so to be a fixed point we need p=3*k-1. Note that k=prime_pi(p), so we seek solutions to p=3*pi(p)-1, which cannot occur if p > 3*pi(p)-1 (i.e., if the prime is larger than its destination), or equivalently if pi(p) < (p+1)/3. Using pi(n) < 1.25506*n/log(n) for n > 1, we find there can be no prime fixed points for p >= 40. Inspection reveals only 2 and 29.
Now consider the nonprimes: after permutation the k-th nonprime r appears either at 3*(k+1)/2 (if k is odd) or 3*k/2-2 (if k is even). Write k = nonprime_pi(r) = r-pi(r). To prove r appears at an index > r, it suffices to show 3*k/2-2 > r, or pi(r) < r/3 - 4/3. Again, we have that pi(n) < 1.25506*n/log(n), which rules out nonprime fixed points with r >= 58. By inspection we find the remaining terms, and the set is complete. QED. I would appreciate it if someone would check this proof. (End)
The first trisection of the sequence equals the second bisection of the nonprimes: a(3*k-2) = A018252(2*k), k > 0.
The second trisection of the sequence equals the primes: a(3*k-1) = A000040(k), k > 0.
The third trisection of the sequence equals the first bisection of the nonprimes: a(3*k) = A018252(2*k-1), k > 0.
In other words: Sequence is the interleaving of second bisection of A018252, A000040, first bisection of A018252.
Sequence is the concatenation of consecutive sections of length 3 reversed of A115316.
MATHEMATICA
pr=Prime[Range[1000]]; np=Complement[Range[pr[[-1]]], pr];
FL=Flatten@Transpose[{Table[np[[k]], {k, 2, 1000, 2}], Take[pr, 500], Table[np[[k]], {k, 1, 999, 2}]}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Dec 06 2010
STATUS
approved

Search completed in 0.007 seconds