[go: up one dir, main page]

login
Search: a124123 -id:a124123
     Sort: relevance | references | number | modified | created      Format: long | short | data
a(n) = ceiling(n/2) if n == 2 (mod 3), a(n) = 2n otherwise.
+10
9
0, 2, 1, 6, 8, 3, 12, 14, 4, 18, 20, 6, 24, 26, 7, 30, 32, 9, 36, 38, 10, 42, 44, 12, 48, 50, 13, 54, 56, 15, 60, 62, 16, 66, 68, 18, 72, 74, 19, 78, 80, 21, 84, 86, 22, 90, 92, 24, 96, 98, 25, 102, 104, 27, 108, 110, 28, 114, 116, 30, 120, 122, 31, 126, 128, 33, 132, 134, 34
OFFSET
0,2
COMMENTS
This map is inspired by A124123, which hides in fact a variation of the Collatz problem, defined on the set of primes and working mod 3 instead of mod 2. See A138751 for more information.
The use of ceiling() is here equivalent to round().
The main reason for defining this function is to write A124123 as complement of A007918(A138750(A000040)), and to express the recursion function occurring there in terms of this map.
It might have been more natural to define this map as a(n) = 2n if n == 1 (mod 3), a(n) = ceiling(n/2) otherwise, which is equivalent for all primes > 3 (which are either == 1 or == 2 (mod 3)) and would have "better" properties regarding the analysis of orbits of all integers under this map.
However, for the prime n=3 it does make a difference, and in order to reproduce the map occurring in A124123, we had to adopt the present convention.
FORMULA
G.f.: x*(2 + x + 6*x^2 + 6*x^3 + 2*x^4 + 6*x^5 + 4*x^6) / ( (1+x)*(x^2-x+1)*(x-1)^2*(1+x+x^2)^2 ). - R. J. Mathar, Oct 16 2013
a(n) = a(n-3) + a(n-6) - a(n-9); a(0)=0, a(1)=2, a(2)=1, a(3)=6, a(4)=8, a(5)=3, a(6)=12, a(7)=14, a(8)=4. - Harvey P. Dale, Nov 20 2013
Sum_{n>=1} (-1)^n/a(n) = log(3)/2 - log(2)/3 = log(27/4)/6. - Amiram Eldar, Jul 26 2024
EXAMPLE
a(0) = 2*0 = 0, a(1) = 2*1 = 2, a(3) = 2*3 = 6, a(4) = 2*4 = 8, ... since these indices are not congruent to 2 (mod 3).
a(2) = ceiling(2/2) = 1, a(5) = ceiling(5/2) = 3, a(8) = ceiling(8/2) = 4, a(11) = ceiling(11/2) = 6, ... since these indices are congruent to 2 (mod 3).
MATHEMATICA
Table[If[Mod[n, 3]==2, Ceiling[n/2], 2n], {n, 0, 70}] (* or *) LinearRecurrence[{0, 0, 1, 0, 0, 1, 0, 0, -1}, {0, 2, 1, 6, 8, 3, 12, 14, 4}, 70] (* Harvey P. Dale, Nov 20 2013 *)
PROG
(PARI) A138750(n) = if( n%3==2, ceil(n/2), 2*n )
CROSSREFS
Cf. A001281, A124123, A138751, A138752, A138753, A008588 (trisection), A016933 (trisection), A032766 (trisection)
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Mar 28 2008
STATUS
approved
Number of iterations of A138754 before reaching a number for the second time, when starting with n.
+10
9
1, 4, 5, 3, 3, 5, 3, 8, 6, 4, 21, 17, 7, 7, 5, 5, 22, 24, 20, 18, 18, 16, 8, 6, 8, 6, 29, 23, 27, 23, 23, 21, 19, 19, 17, 21, 17, 15, 7, 7, 9, 60, 9, 9, 7, 30, 28, 26, 24, 26, 24, 24, 28, 24, 22, 20, 20, 22, 20, 18, 20, 18, 20, 18, 18, 16, 14, 12, 10, 12, 10, 61, 59, 55, 12, 10, 8, 31
OFFSET
1,2
COMMENTS
This is a variation of A138752, giving the number of iterations of A138754 needed to get any number for the second time, while A138752 stops counting somehow arbitrarily at 1=primepi(2) or 4=primepi(7).
The map A138754 is a variation of the Collatz map where parity of the integers is replaced by p mod 3 for the primes.
For the Collatz map, we have the only fixed point 0=f(0) and all other numbers seem to end up in the cycle 1->4->2->1.
Here the only fixed point is 1=A138754(1) and all other numbers seem to end up in the cycle 4 -> 7 -> 5 -> 4 (corresponding to primes 7 -> 17 -> 11 -> 7).
Depending on which number among primepi({2,7,11,17}) is reached first, A138753(n) = A138752(n)+1,+3,+2 resp. +1. (A138752(n) is the length of the so-called GB-sequence starting with prime(n).)
FORMULA
a(n) = min { k>0 | A138754^k(n) = A138754^m(n) for some m>=0, m<k }.
If n is not in {1,4,5,7}, then a(n) = 1+a(A138754(n)).
EXAMPLE
a(1)=1 since after 1 step we find 1 again.
a(4)=3 since 4 -> 7 -> 5 -> 4 under A138754.
MATHEMATICA
A138754[n_]:=A138754[n]=With[{p=Prime[n]}, PrimePi[NextPrime[If[Mod[p, 3]==2, p/2, 2p]]]];
A138753[n_]:=Length[NestWhileList[A138754, n, UnsameQ, {1, 4}]]-1;
Array[A138753, 100] (* Paolo Xausa, Jul 28 2023*)
PROG
(PARI) A138753(n, c=0, t=[1, 1, 1]) = { until( t[c++%3+1]==n=A138754(n), t[c%3+1]=n); c}
CROSSREFS
Cf. A124123, A006577, A171938, A138756 (record values/indices).
KEYWORD
nonn
AUTHOR
M. F. Hasler, Apr 01 2008
STATUS
approved
a(n) = nextprime( p(n)/2 if p(n)=2 (mod 3), 2p(n) else ) = A007918( A138750( A000040( n ))).
+10
7
2, 7, 3, 17, 7, 29, 11, 41, 13, 17, 67, 79, 23, 89, 29, 29, 31, 127, 137, 37, 149, 163, 43, 47, 197, 53, 211, 59, 223, 59, 257, 67, 71, 281, 79, 307, 317, 331, 89, 89, 97, 367, 97, 389, 101, 401, 431, 449, 127, 461, 127, 127, 487, 127, 131, 137, 137, 547, 557, 149
OFFSET
1,1
COMMENTS
Composing the map A138750 with A007918 to the left and restricting it to the primes makes it a mapping from primes into primes which is a natural generalization of the Collatz problem to primes. (Looking at parity would not be interesting for primes, so using "mod 3" is the simplest nontrivial generalization.)
The only even prime p=2 is the only fixed point of this map and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in A138752.
The sequence A124123 lists the primes which do not occur in the present sequence.
See A138750 for further information.
FORMULA
a(n) = A007918(A138750(A000040(n))).
EXAMPLE
a(1) = nextprime(2/2) = 2, a(2) = nextprime(2*3) = 7, a(3) = nextprime(5/2) = 7.
MATHEMATICA
A138751[n_]:=With[{p=Prime[n]}, NextPrime[If[Mod[p, 3]==2, p/2, 2p]]]; Array[A138751, 100] (* Paolo Xausa, Jul 28 2023 *)
PROG
(PARI) A138751(n) = { n=prime(n); nextprime( if( n%3==2, ceil(n/2), 2*n ))}
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Mar 28 2008
STATUS
approved
a(n) = PrimePi(A138751(n)) - a variation of the Collatz (3n+1) map.
+10
7
1, 4, 2, 7, 4, 10, 5, 13, 6, 7, 19, 22, 9, 24, 10, 10, 11, 31, 33, 12, 35, 38, 14, 15, 45, 16, 47, 17, 48, 17, 55, 19, 20, 60, 22, 63, 66, 67, 24, 24, 25, 73, 25, 77, 26, 79, 83, 87, 31, 89, 31, 31, 93, 31, 32, 33, 33, 101, 102, 35, 104, 35, 113, 37, 115, 38, 122, 123, 41, 126
OFFSET
1,2
COMMENTS
This map is a variation of the Collatz (or 3n+1) map:
Instead of considering the parity of the number, we look at prime(n) mod 3 to decide if this prime should be halved or doubled, before going to the next prime (A007918) and finally back to the positive integers via PrimePi (A000720).
Exactly as for the Collatz (3n+1) map (defined on nonnegative integers), the first element for which it is defined is its only fixed point, and all other starting values seem to end up in a cycle of length 3, here: 4 -> 7 -> 5 -> 4.
Except for p=3, no prime yields a prime result under the map A138750 (as can be seen using p=6k+1 or p=6k-1). Therefore instead of applying primepi() after nextprime(), one could also simply use 1+primepi().
The prime p=3 is also the only case where n == 2 (mod 3) is not equivalent to n != 1 (mod 3). It might have been a better choice to define A138750(x)=2x if x == 1 (mod 3), ceiling(x/2) otherwise. But since here it makes only a difference for p=3, we use the original definition (cf. A124123).
FORMULA
EXAMPLE
a(4) = 7 since prime(4) = 7 == 1 (mod 3), thus A138750(7) = 2*7 = 14, nextprime(14) = 17, PrimePi(17) = 7 (i.e., 17 is the 7th prime).
a(5) = 4 since prime(5) = 11 == 2 (mod 3), thus A138750(11) = ceiling(11/2) = 6, nextprime(6) = 7, PrimePi(7) = 4 (i.e., 7 is the 4th prime).
MATHEMATICA
A138754[n_]:=With[{p=Prime[n]}, PrimePi[NextPrime[If[Mod[p, 3]==2, p/2, 2p]]]]; Array[A138754, 100] (* Paolo Xausa, Jul 28 2023 *)
PROG
(PARI) A138754(n)=primepi(A138751(n)) /* see there */
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Apr 01 2008
STATUS
approved
Number of iterations before prime(n) reaches 7 or 2 under x -> A007918(A138750(x)).
+10
6
0, 1, 2, 0, 1, 4, 2, 7, 5, 3, 20, 16, 6, 6, 4, 4, 21, 23, 19, 17, 17, 15, 7, 5, 7, 5, 28, 22, 26, 22, 22, 20, 18, 18, 16, 20, 16, 14, 6, 6, 8, 59, 8, 8, 6, 29, 27, 25, 23, 25, 23, 23, 27, 23, 21, 19, 19, 21, 19, 17, 19, 17, 19, 17, 17, 15, 13, 11, 9, 11, 9, 60, 58, 54, 11, 9, 7, 30, 28
OFFSET
1,3
COMMENTS
As explained in A138751, the map x->A007918(A138750(x)) is a natural generalization of the Collatz map to primes.
The only even prime p=2 is the only fixed point of this map, and all odd primes seem to end up in the loop 7 -> 17 -> 11 -> 7, after a number of steps given in the present sequence.
(It might have been more natural to count the steps until a number is reached for the second time. Depending on which number among {2,7,11,17} is reached first, this would increase the value of a(n) by 1,3,2 resp. 1.)
EXAMPLE
a(1)=a(4)=0 since prime(1)=2 and prime(4)=7 are by definition the values at which counting ends.
a(primepi(4499221))=63337 according to G. Brougnard, cf. Link.
MATHEMATICA
A138752[n_]:=Length[NestWhileList[NextPrime[If[Mod[#, 3]==2, #/2, 2#]]&, Prime[n], #!=2&&#!=7&]]-1; Array[A138752, 100] (* Paolo Xausa, Jul 28 2023 *)
PROG
(PARI) A138752(n, c=0) = { if( n==1 & 7==n=prime(n), 0, until( 7==n=nextprime( if( n%3==2, ceil(n/2), 2*n )), c++); c)}
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Mar 28 2008
STATUS
approved
Indices of record values in A138753 (a "prime" variation of the Collatz (3n+1) problem).
+10
3
1, 2, 3, 8, 11, 17, 18, 27, 42, 72, 125, 219, 221, 401, 515, 556, 754, 841, 1146
OFFSET
1,2
COMMENTS
"Indices of ..." is equivalent to "starting values for ..."
FORMULA
a(n) = min { k | A138753(k) = A171938(n) }
Equals { m | A138753(k) < A138753(m) for all k<m }
MATHEMATICA
A138754[n_]:=A138754[n]=With[{p=Prime[n]}, PrimePi[NextPrime[If[Mod[p, 3]==2, p/2, 2p]]]];
A138753[n_]:=Length[NestWhileList[A138754, n, UnsameQ, {1, 4}]]-1;
A138756list[upto_]:=Module[{v, r=0}, Table[If[(v=A138753[n])>r, r=v; n, Nothing], {n, upto}]];
A138756list[500] (* Paolo Xausa, Jul 30 2023 *)
PROG
(PARI) m=0; for( i=1, #A138753, A138753[i] > m || next; m=A138753[i]; print1(i", "))
CROSSREFS
Cf. A124123, A138750-A138754, A171938, A006877 (analog for Collatz problem).
KEYWORD
nonn,hard,more
AUTHOR
M. F. Hasler, Apr 01 2008
EXTENSIONS
a(15)-a(19) from Paolo Xausa, Jul 30 2023
STATUS
approved
Record values in A138753 (a "prime" variation of the Collatz (3n+1) problem).
+10
3
1, 4, 5, 8, 21, 22, 24, 29, 60, 61, 72, 73, 97, 100, 184, 216, 239, 451, 469
OFFSET
1,2
FORMULA
A171938 = { A138753(m) | A138753(k) < A138753(m) for all k<m }.
MATHEMATICA
A138754[n_]:=A138754[n]=With[{p=Prime[n]}, PrimePi[NextPrime[If[Mod[p, 3]==2, p/2, 2p]]]];
A138753[n_]:=Length[NestWhileList[A138754, n, UnsameQ, {1, 4}]]-1;
A171938list[upto_]:=Module[{v, r=0}, Table[If[(v=A138753[n])>r, r=v, Nothing], {n, upto}]];
A171938list[500] (* Paolo Xausa, Jul 29 2023 *)
PROG
(PARI) m=0; for( i=1, #A138753, A138753[i] > m & print1( m=A138753[i], ", "))
CROSSREFS
Cf. A124123, A138750-A138754, A138756, A006878 (analog for Collatz problem).
KEYWORD
nonn,hard,more
AUTHOR
M. F. Hasler, Apr 01 2008
EXTENSIONS
Originally submitted as A138755, but mislaid by Editor-in-Chief; renumbered and added to OEIS, Oct 24 2010
a(15)-a(19) from Paolo Xausa, Jul 29 2023
STATUS
approved
a(n) = A007918(A138750(n)), that is, least prime > n/2 if n=2 (mod 3), > 2n otherwise.
+10
2
2, 2, 2, 7, 11, 3, 13, 17, 5, 19, 23, 7, 29, 29, 7, 31, 37, 11, 37, 41, 11, 43, 47, 13, 53, 53, 13, 59, 59, 17, 61, 67, 17, 67, 71, 19, 73, 79, 19, 79, 83, 23, 89, 89, 23, 97, 97, 29, 97, 101, 29, 103, 107, 29, 109, 113, 29, 127, 127, 31, 127, 127, 31, 127
OFFSET
0,1
COMMENTS
This can be considered as an analog of the Collatz (or 3n+1) map on the set of primes, see A138751 and A138754 for details.
Numbers 0,1,2 go immediately to the unique fixed point 2, all others end up in the cycle 7 -> 17 -> 11 -> 7, after a number of iterations given by A138753(A138757(n))-1 (= A138753(n)-2 if n is prime).
FORMULA
a(n) = A007918(A138750(n)).
For p prime, a(p) = A138751(A000720(p))
EXAMPLE
a(7) = 17 since 7 = 1 (mod 3), thus A138750(7) = 2*7 = 14, nextprime(14) = 17.
a(11) = 7 since 11 = 2 (mod 3), thus A138750(11) = ceiling(11/2) = 6, nextprime(6) = 7.
MATHEMATICA
np1[n_]:=Module[{x=Ceiling[n/2]}, If[PrimeQ[x], x, NextPrime[x]]]; np2[n_]:= Module[{x=2n}, If[PrimeQ[x], x, NextPrime[x]]]; Table[If[Mod[n, 3]==2, np1[n], np2[n]], {n, 0, 70}] (* Harvey P. Dale, Jul 10 2013 *)
PROG
(PARI) A138757(n)=nextprime(if(n%3==2, (n+1)\2, 2*n))
KEYWORD
easy,nonn
AUTHOR
M. F. Hasler, Apr 04 2008
STATUS
approved

Search completed in 0.012 seconds