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.

Showing 1-7 of 7 results.

A073846 a(1) = 1; thereafter, every even-indexed term is prime and every odd-indexed term is composite.

Original entry on oeis.org

1, 2, 4, 3, 6, 5, 8, 7, 9, 11, 10, 13, 12, 17, 14, 19, 15, 23, 16, 29, 18, 31, 20, 37, 21, 41, 22, 43, 24, 47, 25, 53, 26, 59, 27, 61, 28, 67, 30, 71, 32, 73, 33, 79, 34, 83, 35, 89, 36, 97, 38, 101, 39, 103, 40, 107, 42, 109, 44, 113, 45, 127, 46, 131, 48, 137, 49, 139, 50
Offset: 1

Views

Author

Amarnath Murthy, Aug 14 2002

Keywords

Comments

Equals A067747 shifted by one position. a(n) = A067747(n-1) [for n>1]. - R. J. Mathar, Apr 01 2007
From Chayim Lowen, Aug 12 2015: (Start)
Consider f(n,k) = a(f(n,k-1)) with f(n,0) = n. Let us also define f(n,k) for negative values of k as well using: f(n,k-1) = A073898(f(n,k)) where A073898(a(n)) = a(A073898(n)) = n. Let us denote the sequence {f(n,i)} for integers i by R#(n). It is clear that if a is a value in R#(b), R#(a) is just R#(b) with a different offset. Therefore, unless there is a need to do otherwise, let us denote each sequence by its lowest value. These sequences can only behave in one of two ways. They can either be periodic with f(n,m) = f(n,0) for some m, or they can include infinitely many distinct values. Here is the behavior of R#(n) for n<=100:
* R#(1), R#(2) and R#(9) are 1-cycles.
* R#(3), R#(5), R#(7), R#(10) and R#(12) are 2-cycles.
* R#(14), R#(62) and R#(84) are 3-cycles.
* R#(92) is a 6-cycle.
* R#(18) is a 22-cycle.
* R#(34) (A261314) has been checked up to f(34,86) = 1091595086717, R#(42) up to f(42,108) = 106838266736, R#(50) up to f(50,98) = 1078406742163, R#(60) up to f(60,80) = 765456394363, R#(74) up to f(74,78) = 687059343029, R#(82) up to f(82,75) = 682580868743 R#(86) up to f(86,74) = 182831963148, R#(88) up to f(88,66) = 719074799059, and R#(98) up to f(98,88) = 641383978721 without repeated values. Hence, their periods are either extremely large or nonexistent (infinite). I conjecture that the latter is the case. Note that these sequences are not necessarily all distinct as any two may simply be the same sequence with a large offset.
For all other n<=100, a(n) is included in one of the above sequences. (End)
Conjecturally, the integers that belong to one of these cycles are: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 35, 37, 39, 41, 43, 47, 53, 62, 84, 87, 92, 121, 127, 132, 135, 181, 199, 205, 317. - Michel Marcus, Mar 07 2021

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a073846 n = a073846_list !! (n-1)
    a073846_list = concat $ transpose [a018252_list, a000040_list]
    -- Reinhard Zumkeller, Jan 29 2014
    
  • Maple
    N:= 100: # to get a(1) to a(2*N).
    p:= ithprime(N):
    P,NP:= selectremove(isprime,[$1..p]):
    seq(op([NP[i],P[i]]),i=1..N); # Robert Israel, Dec 22 2014
  • Mathematica
    Composite[n_Integer] := FixedPoint[n + PrimePi[ # ] + 1 &, n]; Join[{1}, Flatten[ Transpose[{Table[Prime[n], {n, 1, 35}], Table[Composite[n], {n, 1, 35}]}]]]
    f[upto_]:=Module[{prs=Prime[Range[PrimePi[upto]]],comps},comps= Complement[ Range[upto],prs];Riffle[Take[comps,Length[prs]],prs]]; f[150] (* Harvey P. Dale, Dec 03 2011 *)
  • PARI
    c(n) = for(k=0, primepi(n), isprime(n++)&&k--); n; \\ A002808
    a(n) = if (n==1, 1, if (n%2, c(n\2), prime(n/2))); \\ Michel Marcus, Mar 06 2021
    
  • Python
    from sympy import prime, composite
    def A073846(n): return 1 if n == 1 else (composite(n//2) if n % 2 else prime(n//2)) # Chai Wah Wu, Mar 09 2021

Formula

a(2*n-1) = A018252(n); a(2*n) = A000040(n). - Reinhard Zumkeller, Jan 29 2014
a(n) = A018252(ceiling(n/2))*A000035(n) + A000040(ceiling(n/2))*A059841(n), equivalent to Reinhard Zumkeller's formula. - Chayim Lowen, Jul 29 2015
a(2n)/a(2n-1) ~ log(n). - Thomas Ordowski, Sep 10 2015

Extensions

Edited by Robert G. Wilson v and Benoit Cloitre, Aug 16 2002

A261314 Rocket Sequence 34: a(0)=34, a(n) = A073846(a(n-1)).

Original entry on oeis.org

34, 59, 44, 79, 56, 107, 75, 54, 103, 72, 151, 102, 233, 153, 104, 239, 156, 397, 253, 165, 112, 263, 171, 116, 271, 176, 457, 290, 829, 512, 1619, 974, 3469, 2044, 8123, 4696, 20879, 11861, 6807, 3952, 17159, 9786, 47459
Offset: 0

Views

Author

Chayim Lowen, Aug 14 2015

Keywords

Comments

A073846(n) is defined as follows: if n = 2m for some integer m, A073846(n) is the m-th prime, if n = 2m-1 for some integer m, A073846(n) is the m-th nonprime.
Consider the (totally) ordered set {n, A073846(n), A073846(A073846(n))...} and let us append to this the ordered set {...b(b(b(n))),b(b(n)),b(n)} where b(m) = A073898(m) is the inverse of A073846. Let us call the result R#(n). It is clear that if m is a value in R#(n), R#(m) is just R#(n) with a different offset. Therefore, unless there is a need to do otherwise, let us denote each sequence by its lowest value. {a(n)} when extended to all integers (the last few unlisted values are ... 36, 61, 45, 34) is R#(34).
A given sequence c(n) can be one of two kinds. It can either be periodic with c(m) = c(0) for some m, or it can include infinitely many distinct values. R#(n) is finite for all n<34. However, this sequence has been checked up to a(86) = 1091595086717 without reaching 34. Instead it seems to be slowly climbing in value in both the negative and positive directions. Hence, its period is either extremely large or nonexistent (infinite). I conjecture that the latter is the case. Thus I dubbed the sequence "Rocket" because, as opposed to the "Hailstone" sequences, it never seems to "fall".

Examples

			a(1) = A073846(a(0)) = A073846(34) = 59.
		

Crossrefs

Cf. A073846.

Programs

  • Mathematica
    f[n_, lim_] := Block[{p = Prime@ Range@ PrimePi@ lim, c, s, a = {34}}, c = Complement[Range@ lim, p]; s = Riffle[Take[c, Length@ p], p]; Do[AppendTo[a, s[[a[[k]]]]], {k, n}]; a]; f[48, 10000000] (* Michael De Vlieger, Aug 26 2015, after Harvey P. Dale at A073846 *)

Formula

a(n+1) = A073846(a(n)) = A018252(ceiling(a(n)/2))*A000035(a(n)) + A000040(ceiling(a(n)/2))*A059841(a(n)).
a(n-1) = A073898(a(n)) = 2*A010051(a(n))*A000720(a(n)) + (1-A010051(a(n)))*(2*A018252(a(n))-1).

A073897 a(1) = 1, a(n) = smallest odd or even number not occurring earlier according as n is prime or composite.

Original entry on oeis.org

1, 3, 5, 2, 7, 4, 9, 6, 8, 10, 11, 12, 13, 14, 16, 18, 15, 20, 17, 22, 24, 26, 19, 28, 30, 32, 34, 36, 21, 38, 23, 40, 42, 44, 46, 48, 25, 50, 52, 54, 27, 56, 29, 58, 60, 62, 31, 64, 66, 68, 70, 72, 33, 74, 76, 78, 80, 82, 35, 84, 37, 86, 88, 90, 92, 94, 39
Offset: 1

Views

Author

Amarnath Murthy, Aug 18 2002

Keywords

Crossrefs

Cf. A073898.

Extensions

More terms from Alois P. Heinz, Oct 29 2015

A261621 Rocket Sequence 42: a(0) = 42, a(n) = A073846(a(n-1)).

Original entry on oeis.org

42, 73, 52, 101, 70, 149, 100, 229, 150, 379, 243, 159, 108, 251, 164, 421, 267, 174, 449, 286, 823, 508, 1609, 968, 3461, 2040, 8111, 4689, 2745, 1631, 981, 600, 1987, 1189, 723, 448, 1423, 861, 530, 1697, 1020, 3643, 2146, 8623, 4978, 22193, 12602, 62791
Offset: 0

Views

Author

Chayim Lowen, Sep 09 2015

Keywords

Comments

This sequence has been checked up to a(108) = 106838266736 without reaching 42. It seems to be slowly climbing in value in both the negative and positive directions. Its period is either extremely large or more probably infinite.

Examples

			a(1) = A073846(a(0)) = A073846(42) = 73.
		

Crossrefs

Formula

a(n+1) = A073846(a(n)).
a(n-1) = A073898(a(n)).

A262149 Rocket sequence 50: a(0)=50, a(n)=A073846(a(n-1)).

Original entry on oeis.org

50, 97, 68, 139, 94, 211, 140, 349, 222, 607, 378, 1129, 689, 427, 272, 769, 476, 1493, 901, 552, 1783, 1072, 3863, 2268, 9151, 5275, 3077, 1819, 1092, 3931, 2308, 9323, 5370, 24113, 13671, 7825, 4528, 20021, 11385, 6537, 3796, 16363, 9336, 44927, 25250
Offset: 0

Views

Author

Chayim Lowen, Sep 12 2015

Keywords

Comments

This sequence has been checked up to a(98) = 1078406742163 without reaching 50. It seems to be slowly climbing in value in both the negative and positive directions. Hence, its period is either extremely large or, as I conjecture, infinite. Thus I dubbed the sequence "Rocket" because, as opposed the "Hailstone" sequences, it never seems to "fall".
This sequence, when extended to all integers using a(n-1) = A073898(a(n)), is R#(50), see A073846 for definition. - Chayim Lowen, Jan 25 2016

Examples

			a(1) = A073846(a(0)) = A073846(50) = 97.
		

Crossrefs

Programs

  • Mathematica
    s = Module[{p = Prime@ Range@ PrimePi@ #, c}, c = Complement[Range@ #, p]; Riffle[Take[c, Length@ p], p]] &[5*10^5]; NestList[s[[#]] &, 50, 44] (* Michael De Vlieger, Jan 27 2016, after Harvey P. Dale at A073846 *)

Formula

a(n+1) = A073846(a(n)).
a(n-1) = A073898(a(n)).

Extensions

Missing term 1092 inserted by Chayim Lowen, Mar 26 2017

A263570 Smallest positive integer such that n iterations of A073846 are required to reach an even number.

Original entry on oeis.org

2, 3, 17, 31, 163, 353, 721, 1185, 1981, 3363, 5777, 10039, 29579, 52737, 94705, 171147, 311101, 568431, 1043463, 1923619, 3559911, 6611675, 12319517, 23023727, 651267929, 1234823707, 2345409699, 4462239583, 8502848523, 16226083005, 31007327791, 59331187155
Offset: 0

Views

Author

Chayim Lowen, Oct 21 2015

Keywords

Comments

A number is considered to be its own zeroth iteration.
Is the sequence defined for all n? If so, are there infinitely many composite numbers? If not, are infinitely many a(n) defined?
From Hartmut F. W. Hoft, Apr 05 2016: (Start)
Numbers a(6)...a(11) and a(12)...a(23) each belong to iteration sequences that start with prime numbers 10039 and 23023727, respectively, while the other numbers in the sequences are composite.
For the entire iteration sequences and computation of the additional numbers for this sequence see A271363. (End)
For n>1, a(n) is the least integer k such that the repeated application of x -> A073846(x) strictly decreases exactly n times in a row. - Hugo Pfoertner and Michel Marcus, Mar 11 2021

Examples

			a(2)=17 because A073846(17) = 15, A073846(15) = 14; thus it took two steps whereas no smaller positive integer has this property.
		

Crossrefs

Programs

  • Mathematica
    (* Since A073846(9)=9, search starts with 11 *)
    c25000000 = Select[Range[25000000], CompositeQ];
    a073846[n_] := c25000000[[Floor[n/2]]]
    a073846Nest[n_] := Length[NestWhileList[a073846, n, OddQ]]
    a263570[n_] := Module[{list={2, 3}, i, length}, For[i=11, i<=n, i+=2, length=a073846Nest[i]; If[Length[list]Hartmut F. W. Hoft, Apr 05 2016 *)

Formula

For n>0, a(n+1) >= A073898(b(a(n))), where b(m) is the smallest odd composite not smaller than m, equality always holds if a(n) is composite.

Extensions

a(24)-a(31) from Hartmut F. W. Hoft, Apr 05 2016

A308598 The smaller term of the pair (a(n), a(n+1)) is always prime and in each pair there is a composite number; a(1) = 2 and the sequence is always extended with the smallest integer not yet present and not leading to a contradiction.

Original entry on oeis.org

2, 4, 3, 6, 5, 8, 7, 12, 11, 14, 13, 18, 17, 20, 19, 24, 23, 30, 29, 32, 31, 38, 37, 42, 41, 44, 43, 48, 47, 54, 53, 60, 59, 62, 61, 68, 67, 72, 71, 74, 73, 80, 79, 84, 83, 90, 89, 98, 97, 102, 101, 104, 103, 108, 107, 110, 109, 114, 113, 128, 127, 132, 131, 138, 137, 140, 139, 150, 149
Offset: 1

Views

Author

Bernard Schott, Jun 09 2019

Keywords

Comments

The idea of this sequence comes from A282649 where "larger" replaces "smaller".
The sequence is not a permutation of the positive integers.
The 1st bisection is A000040 (the primes) and the 2nd bisection is A008864 \ {3} (prime(n) + 1).
Consecutive primes p < q separated by composites c = q + 1. - Michael De Vlieger, Jun 09 2019

Examples

			In the 1st pair of integers (2,4) the smaller term is (2), which is prime;
In the 2nd pair of integers (4,3) the smaller term is (3), which is prime;
In the 3rd pair of integers (3,6) the smaller term is (3), which is prime;
In the 4th pair of integers (6,5) the smaller term is (5), which is prime;
In the 5th pair of integers (5,8) the smaller term is (5), which is prime; etc.
		

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A008864 (prime(n) + 1).
Cf. A282649 (similar, with larger term).
Cf. A067747, A073846, A073898 (sequences with same start).

Programs

  • Mathematica
    Fold[Join[#1, {#2, NextPrime@ #2 + 1}] &, {#, NextPrime@ # + 1} &@ 2, Prime@ Range[2, 35]] (* Michael De Vlieger, Jun 09 2019 *)

Formula

n odd: a(n) = prime((n+1)/2) = A000040((n+1)/2).
n even: a(n) = a(n+1) + 1 = prime(n/2 + 1) + 1 = A008864(n/2 + 1).
Alternatively, if a(n-1) is prime, a(n) = 1 + min prime > a(n-1) else a(n) = a(n-1) - 1. - Bill McEachen, May 16 2024
Showing 1-7 of 7 results.