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-5 of 5 results.

A255999 Position of the n-th prime in A253279.

Original entry on oeis.org

2, 4, 8, 17, 79, 42, 76, 82, 157, 85, 205, 307, 65, 145, 170, 325, 1661, 831, 463, 485, 4737, 3946, 993, 1647, 421, 5551, 273, 2398, 183, 6268, 4226, 9224, 703, 2653, 3081, 1167, 1226, 10817, 1297, 19183, 1385, 6890, 2174, 14660, 7922, 21905, 21358, 2917, 2757
Offset: 1

Views

Author

Keywords

Comments

We conjecture that the sequence is infinite or, equivalently, A253279 contains all primes.

Crossrefs

Formula

A253279(a(n)) = prime(n).

A064413 EKG sequence (or ECG sequence): a(1) = 1; a(2) = 2; for n > 2, a(n) = smallest number not already used which shares a factor with a(n-1).

Original entry on oeis.org

1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 15, 18, 14, 7, 21, 24, 16, 20, 22, 11, 33, 27, 30, 25, 35, 28, 26, 13, 39, 36, 32, 34, 17, 51, 42, 38, 19, 57, 45, 40, 44, 46, 23, 69, 48, 50, 52, 54, 56, 49, 63, 60, 55, 65, 70, 58, 29, 87, 66, 62, 31, 93, 72, 64, 68, 74, 37, 111, 75, 78, 76, 80, 82
Offset: 1

Views

Author

Jonathan Ayres (Jonathan.ayres(AT)btinternet.com), Sep 30 2001

Keywords

Comments

Locally, the graph looks like an EKG (American English) or ECG (British English).
Calculating the square of A064413 and plotting the results shows the EKG behavior even more dramatically - see A104125. - Parthasarathy Nambi, Jan 27 2005
Theorem: (1) Every number appears exactly once: this is a permutation of the positive numbers. - J. C. Lagarias, E. M. Rains, N. J. A. Sloane, Oct 03 2001
The permutation has cycles (1) (2) (3, 4, 6, 9, 10, 5) (..., 20, 18, 12, 7, 14, 13, 28, 26, ...) (8) ...
Theorem: (2) The primes appear in increasing order. - J. C. Lagarias, E. M. Rains, N. J. A. Sloane, Oct 03 2001
Theorem: (3) When an odd prime p appears it is immediately preceded by 2p and followed by 3p. - Conjectured by Lagarias-Rains-Sloane, proved by Hofman-Pilipczuk.
Theorem: (4) Let a'(n) be the same sequence but with all terms p and 3p (p prime) changed to 2p (see A256417). Then lim a'(n)/n = 1, i.e., a(n) ~ n except for the values p and 3p for p prime. - Conjectured by Lagarias-Rains-Sloane, proved by Hofman-Pilipczuk.
Conjecture: If a(n) != p, then almost everywhere a(n) > n. - Thomas Ordowski, Jan 23 2009
Conjecture: lim #(a_n > n) / n = 1, i.e., #(a_n > n) ~ n. - Thomas Ordowski, Jan 23 2009
Conjecture: A term p^2, p a prime, is immediately preceded by p*(p+1) and followed by p*(p+2). - Vladimir Baltic, Oct 03 2001. This is false, for example the sequence contains the 3 terms p*(p+2), p^2, p*(p+3) for p = 157. - Eric Rains
Theorem: If a(k) = 3p, then |{a(m) : a(m>k) < 3p}| = 3p - k. Proof: If a(k) = 3p, then all a(mk) > p and |{a(m) : a(m>k) < 3p}| = 3p - k. - Thomas Ordowski, Jan 22 2009
Let ...,a_i,...,2p,p,3p,...,a_j,... There does not exist a_i > 3p. There does not exist a_j < p. - Thomas Ordowski, Jan 20 2009
Let...,a,...,2p,p,3p,...,b,... All a<3p and b>p. #(a>2p) <= #(b<2p). - Thomas Ordowski, Jan 21 2009
If a(k)=3p then |{a(m):a(m>k)<3p}|=3p-k. - Thomas Ordowski, Jan 22 2009
GCD(a(n),n) = A247379(n). - Reinhard Zumkeller, Sep 16 2014
If the definition is changed to require that the GCD of successive terms be a prime power > 1, the sequence stays the same until a(578)=620, at which point a(579)=610 has GCD = 10 with the previous term. - N. J. A. Sloane, Mar 30 2015
From Michael De Vlieger, Dec 06 2021: (Start)
For prime p > 2, we have the chain {j : 2|j} -> 2p -> p -> 3p -> {k : 3|k}. The term j introducing 2p must be even, since 2p is an even squarefree semiprime proved by Hofman-Pilipczuk to introduce p itself. Hence no term a(i) such that p | a(i) exists in the sequence for i < n-1, where a(n) = p, leaving 2|j. Similarly, the term k following 3p must be divisible by 3 since the terms mp that are not coprime to p (thus implying p | mp) have m >= 4, thereby large compared to numbers k such that 3|k that belong to the cototient of 3p. For the chain {4, 6, 3, 9, 12}, the term 12 following 3p indeed is 4p, but p = 3; this is the only case of 4p following 3p in the sequence. As a consequence, for i > 1, A073734(A064955(i)-1) = 2 and A073734(A064955(i)+2) = 3.
For Fermat primes p, we have the chain {j : 2|j} -> 2^e-> {2p = 2^e + 2} -> {p = 2^(e-1) + 1} -> 3p -> {k : 3|k}.
a(3) = 4 = 2^2, a(5) = 3 = 2^1 + 1;
a(8) = 8 = 2^3, a(10) = 5 = 2^2 + 1;
a(31) = 32 = 2^5, a(33) = 17 = 2^4 + 1;
a(485) = 512 = 2^9, a(487) = 257 = 2^8 + 1;
a(127354) = 131072 = 2^17, a(127356) = 65537 = 2^16 + 1.
(End)

Examples

			a(2) = 2, a(3) = 4 (gcd(2,4) = 2), a(4) = 6 (gcd(4,6) = 2), a(5) = 3 (gcd(6,3) = 3), a(6) = 9 (6 already used so next number which shares a factor is 9 since gcd(3,9) = 3).
		

References

  • N. J. A. Sloane, Seven Staggering Sequences, in Homage to a Pied Puzzler, E. Pegg Jr., A. H. Schoen and T. Rodgers (editors), A. K. Peters, Wellesley, MA, 2009, pp. 93-110.

Crossrefs

A073734 gives GCD's of successive terms.
See A064664 for the inverse permutation. See A064665-A064668 for the first two infinite cycles of this permutation. A064669 gives cycle representatives.
See A064421 for sequence giving term at which n appears.
See A064424, A074177 for records.
Cf. A064955 & A352194 (prime positions), A195376 (parity), A064957 (positions of odd terms), A064953 (positions of even terms), A064426 (first differences).
See A169857 and A119415 for the effect of changing the start.
Cf. A240024 (nonprime version).
Cf. A152458 (fixed points), A247379, A247383.
For other initial terms, see A169841, A169837, A169843, A169855, A169849.
A256417 is a smoothed version.
See also A255582, A256466, A257218, A257311-A257315, A257405, A253279 (two-dimensional analog).
See also A276127.

Programs

  • Haskell
    import Data.List (delete, genericIndex)
    a064413 n = genericIndex a064413_list (n - 1)
    a064413_list = 1 : f 2 [2..] where
       ekg x zs = f zs where
           f (y:ys) = if gcd x y > 1 then y : ekg y (delete y zs) else f ys
    -- Reinhard Zumkeller, May 01 2014, Sep 17 2011
    
  • Maple
    h := array(1..20000); a := array(1..10000); maxa := 300; maxn := 2*maxa; for n from 1 to maxn do h[n] := -1; od: a[1] := 2; h[2] := 1; c := 2; for n from 2 to maxa do for m from 2 to maxn do t1 := gcd(m,c); if t1 > 1 and h[m] = -1 then c := m; a[n] := c; h[c] := n; break; fi; od: od: ap := []: for n from 1 to maxa do ap := [op(ap),a[n]]; od: hp := []: for n from 2 to maxa do hp := [op(hp),h[n]]; od: convert(ap,list); convert(hp,list); # this is very crude!
    N:= 1000: # to get terms before the first term > N
    V:= Vector(N):
    A[1]:= 1:
    A[2]:= 2: V[2]:= 1:
    for n from 3 do
      S:= {seq(seq(k*p,k=1..N/p),p=numtheory:-factorset(A[n-1]))};
      for s in sort(convert(S,list)) do
        if V[s] = 0 then
          A[n]:= s;
          break
        fi
      od;
      if V[s] = 1 then break fi;
      V[s]:= 1;
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Jan 18 2016
  • Mathematica
    maxN = 100; ekg = {1, 2}; unused = Range[3, maxN]; found = True; While[found, found = False; i = 0; While[ !found && i < Length[unused], i++; If[GCD[ekg[[-1]], unused[[i]]] > 1, found = True; AppendTo[ekg, unused[[i]]]; unused = Delete[unused, i]]]]; ekg (* Ayres *)
    ekGrapher[s_List] := Block[{m = s[[-1]], k = 3}, While[MemberQ[s, k] || GCD[m, k] == 1, k++ ]; Append[s, k]]; Nest[ekGrapher, {1, 2}, 71] (* Robert G. Wilson v, May 20 2009 *)
  • PARI
    a1=1; a2=2; v=[1,2];
    for(n=3,100,a3=if(n<0,0,t=1;while(vecmin(vector(length(v),i,abs(v[i]-t)))*(gcd(a2,t)-1)==0,t++);t);a2=a3;v=concat(v,a3););
    a(n)=v[n];
    /* Benoit Cloitre, Sep 23 2012 */
    
  • Python
    from math import gcd
    A064413_list, l, s, b = [1,2], 2, 3, {}
    for _ in range(10**5):
        i = s
        while True:
            if not i in b and gcd(i, l) > 1:
                A064413_list.append(i)
                l, b[i] = i, True
                while s in b:
                    b.pop(s)
                    s += 1
                break
            i += 1 # Chai Wah Wu, Dec 08 2014

Formula

a(n) = smallest number not already used such that gcd(a(n), a(n-1)) > 1.
In Lagarias-Rains-Sloane (2002), it is conjectured that almost all a(n) satisfy the asymptotic formula a(n) = n (1+ 1/(3 log n)) + o(n/log n) as n -> oo and that the exceptional terms when the sequence is a prime or 3 times a prime p produce the spikes in the sequence. See the paper for a more precise statement of the conjecture. - N. J. A. Sloane, Mar 07 2015

Extensions

More terms from Naohiro Nomoto, Sep 30 2001
Entry extensively revised by N. J. A. Sloane, Oct 10 2001

A354434 a(1) = 1; for n > 1, a(n) is the smallest unused square spiral number such that a(n) shares a factor with all existing numbers in its Moore neighborhood.

Original entry on oeis.org

1, 2, 4, 6, 3, 9, 12, 18, 8, 10, 14, 16, 20, 22, 24, 15, 21, 27, 30, 33, 36, 39, 26, 28, 32, 34, 38, 40, 42, 44, 46, 48, 50, 54, 45, 35, 7, 63, 51, 57, 60, 66, 52, 72, 78, 84, 56, 58, 62, 64, 68, 70, 74, 76, 80, 82, 86, 88, 90, 75, 96, 100, 105, 49, 77, 91, 119, 102, 69, 81, 108, 92, 94, 98, 104
Offset: 1

Views

Author

Scott R. Shannon, May 28 2022

Keywords

Comments

The sequence is conjectured to be a permutation of the positive integers, although it takes many terms for most primes to appear, e.g. a(1807) = 13, a(35156) = 179. The primes do not occur in their natural order. In the first 200000 terms the smallest unused prime is 181, while the smallest unused composite number is 11881, which is itself a prime power.

Examples

			The spiral begins
                                .
                                .
    7--35--45--54--50--48--46  82
    |                       |   |
   63  21--15--24--22--20  44  80
    |   |               |   |   |
   51  27   3---6---4  16  42  76
    |   |   |       |   |   |   |
   57  30   9   1---2  14  40  74
    |   |   |           |   |   |
   60  33  12--18---8--10  38  70
    |   |                   |   |
   66  36--39--26--28--32--34  68
    |                           |
   52--72--78--84--56--58--62--64
.
.
a(11) = 14 as the existing numbers in the Moore neighborhood when a(11) is being placed are 4,2,8,10, and 14 is the smallest unused number that shares a factor with all these numbers.
		

Crossrefs

A336946 a(1) = 1; for n > 1, a(n) is the next square spiral number not already used such that a(n) shares a factor with a(n-1) and also with the adjacent number on the inner spiral arm if such a number exists.

Original entry on oeis.org

1, 2, 4, 6, 3, 9, 12, 8, 10, 5, 20, 14, 7, 28, 16, 18, 15, 21, 24, 22, 11, 33, 30, 25, 35, 40, 45, 36, 26, 42, 27, 63, 48, 32, 34, 50, 38, 54, 39, 51, 60, 44, 46, 66, 55, 65, 70, 49, 56, 52, 58, 72, 57, 76, 62, 78, 13, 117, 69, 75, 80, 64, 68, 74, 37, 148
Offset: 1

Views

Author

Scott R. Shannon, Aug 08 2020

Keywords

Comments

This is a variation of the EKG sequence A064413 where the numbers are written on the square spiral such that each new number must share a common factor with not only the previous number but also with the adjacent inner spiral number, in one of the four axial directions, if such a number exists. This additional restriction causes the numbers to violate some of the patterns the numbers form in the standard EKG sequence, e.g., an odd prime p does not need to be preceded by 2p or followed by 3p, and the primes do not appear in increasing order.
For the first 100000 terms the smallest unseen number is 433.

Examples

			The spiral begins
                                .
                                .
   38--50--34--32--48--63--27  78
    |                       |   |
   54  15--18--16--28---7  42  62
    |   |               |   |   |
   39  21   3---6---4  14  26  76
    |   |   |       |   |   |   |
   51  24   9   1---2  20  36  57
    |   |   |           |   |   |
   60  22  12---8--10---5  45  72
    |   |                   |   |
   44  11--33--30--25--35--40  58
    |                           |
   46--66--55--65--70--49--56--52
.
a(1)-a(8) = 1,2,4,6,3,9,12,8. The adjacent inner spiral number is 1 which all numbers share a factor with so the numbers are the same as A064413(n).
a(9) = 10. This is the first number that must have a common factor with two numbers, the previous number a(8) = 8 and the adjacent spiral number a(2) = 2. The lowest unused number satisfying this requirement is 10.
a(10) = 5. As this number is on the corner of a square spiral arm it only needs to share a divisor with a(9) = 10. The lowest unseen number satisfying this is 5.
a(11) = 20.  This number must have a common factor with the previous number a(10) = 5 and the adjacent spiral number a(2) = 2. The lowest unused number satisfying this requirement is 20. This is also the first number to differ from  A064413 which only needs to find the lowest unused number sharing a factor with 5, which is 15.
		

Crossrefs

A358153 Lexicographically earliest infinite sequence of distinct positive integers on a square spiral such that each number shares a factor with its four orthogonally nearest neighbors but shares no factor with its four diagonal next-nearest neighbors.

Original entry on oeis.org

6, 10, 35, 21, 77, 22, 143, 39, 65, 117, 12, 63, 18, 20, 24, 44, 26, 273, 30, 195, 36, 88, 42, 40, 48, 14, 455, 50, 175, 80, 55, 33, 385, 147, 539, 91, 105, 110, 847, 176, 1001, 28, 119, 51, 187, 153, 85, 459, 595, 15, 54, 351, 66, 189, 72, 99, 57, 95, 114, 100, 78, 220, 52, 60, 34, 833
Offset: 1

Views

Author

Scott R. Shannon, Nov 01 2022

Keywords

Comments

This sequence is a 2D square lattice version of the Enots Wolley sequence A336957. Like that sequence, for this sequence to be infinite no number can be a prime or prime power - the first term must therefore be 6. Likewise, for each of its orthogonal nearest neighbors, a new number must have at least one prime factor that is not a factor of that neighbor. When choosing each new number a further test must also be performed against the previous number that is two squares ahead of the current number and on the edge of the spiral - this number is outside the eight nearest neighbors of the number being determined. See the examples below.
Like A336957 is it conjectured that all nonprime powers eventually appear. In the first 10000 terms the largest value is a(6975) = 3005315.

Examples

			The spiral begins:
.                                             .
                                              .
   105----91---539---147---385----33----55    99
    |                                   |     |
   110    26----44----24----20----18    80    72
    |     |                       |     |     |
   847   273    77----21----35    63   175   189
    |     |     |           |     |     |     |
   176    30    22     6----10    12    50    66
    |     |     |                 |     |     |
  1001   195   143----39----65---117   455   351
    |     |                             |     |
    28    36----88----42----40----48----14    54
    |                                         |
   119----51---187---153----85---459---595----15
.
.
a(5) = 22. The two orthogonal nearest neighbors to the square at (-1,0), relative to the starting central square 6, are 6 and 77. Therefore the new number at that position must share a factor with both of these numbers while containing a factor they do not have. Also the new number must have no factor in common with any diagonal next-nearest neighbors. Only one exists in this case, namely 21. The smallest unused number satisfying all of these conditions is 22.
a(6) = 143. For the square at (-1,-1) the orthogonal nearest neighbor is 22, while the diagonal next-nearest neighbor is 6. As 22 has 2 and 11 as factors, while 6 has 2 and 3, the new number can only be a multiple of 11, must have a factor other than 2 and 11 while not being a multiple of 2 or 3. The smallest unused number satisfying these conditions is 55. However this is where another check must be performed, namely against the number two squares ahead on the spiral from the current number - the number at (1,0) which in this case is 10. The reason this must be checked is that if 55 is chosen as the new number at (-1,-1) then that would force the next number at (0,-1) to be a multiple of 5 - only 5 and 11 are factors of 55 but 11 cannot be a factor of the new number at (0,-1) since it is an orthogonal neighbor to 22 with which it cannot share a factor. But forcing the number at (0,-1) to have 5 as a factor is not permitted since it would then share a factor with its diagonal neighbor 10 at (1,0). This is why the prime factors of the number two squares ahead on the spiral need to be checked when choosing the current number. Once a candidate number for the current square is chosen a list of the prime factors it has that are not factors of the previous number, 22 in this case, is created. This list is then compared against the factors of the number two squares ahead on the spiral, if such a number exists. If that number has as factors all the numbers in the list, then a new candidate number must be chosen else it would lead to the issue described above when the next new number is created. In this case choosing 55 leads to a list containing only 5, but that is a factor of 10, so 55 cannot be chosen. The next valid number that satisfies all the factor requirements and also has a factor not in either 22 or 10 is 11*13 = 143.
		

Crossrefs

Showing 1-5 of 5 results.