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

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

A257311 a(1) = 4; a(2) = 5; for n > 2, a(n) is the smallest number of the form prime + 2 not already used which shares a factor with a(n-1).

Original entry on oeis.org

4, 5, 15, 9, 21, 7, 49, 63, 33, 39, 13, 91, 105, 25, 45, 55, 75, 69, 81, 99, 111, 129, 43, 559, 169, 195, 85, 115, 165, 141, 153, 159, 183, 61, 549, 201, 213, 225, 175, 133, 19, 285, 231, 243, 273, 259, 315, 235, 265, 295, 355, 375, 279, 31, 403, 351, 309, 103
Offset: 1

Views

Author

Vladimir Shevelev, Apr 20 2015

Keywords

Comments

Analog of EKG-sequence (A064413) on the numbers of the form prime + 2.
Conjecture: the sequence {a(n)-2} is a permutation of the primes (A000040).
Every prime in the sequence is greater of twin primes (A006512).
A generalization. Let A_k (k>=1) be the following sequence: a(1) = 2^k+2; a(2) = 2^k+3; for n > 2, a(n) is the smallest number of the form 2^k+prime not already used which shares a factor with a(n-1).
Conjecture: For every k>=1, the sequence A_k - 2^k is a permutation of the primes.
A_1 = A257311, A_2 = A257312, A_3 = A257313, A_4 = A257314, A_5 = A257315.

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{o = 2, s, p, k}, s = {o + 2, o + 3}; For[k = 3, k <= n, k++, p = 2; While[GCD[p + o, s[[k - 1]]] == 1 || MemberQ[s, p + o], p = NextPrime@ p]; AppendTo[s, p + o]]; s]; f@ 58 (* Michael De Vlieger, Apr 20 2015 *)

Extensions

More terms from Peter J. C. Moses, Apr 20 2015

A257312 a(1) = 6; a(2) = 7; for n > 2, a(n) is the smallest number of the form prime + 4 not already used which shares a factor with a(n-1).

Original entry on oeis.org

6, 7, 21, 9, 15, 27, 33, 11, 77, 35, 45, 51, 17, 153, 57, 63, 75, 65, 105, 87, 93, 111, 117, 135, 141, 47, 423, 171, 177, 183, 195, 143, 231, 161, 23, 437, 285, 155, 185, 215, 245, 203, 261, 201, 237, 243, 255, 267, 273, 287, 41, 861, 297, 275, 315, 321, 107
Offset: 1

Views

Author

Vladimir Shevelev, Apr 20 2015

Keywords

Comments

Analog of EKG-sequence (A064413) on the numbers of the form prime + 4.
Conjecture: the sequence {a(n)-4} is a permutation of primes (A000040).

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{o = 2^2, s, p, k}, s = {o + 2, o + 3}; For[k = 3, k <= n, k++, p = 2; While[GCD[p + o, s[[k - 1]]] == 1 || MemberQ[s, p + o], p = NextPrime@ p]; AppendTo[s, p + o]]; s]; f@ 57 (* Michael De Vlieger, Apr 20 2015 *)

Extensions

More terms from Peter J. C. Moses, Apr 20 2015

A257313 a(1) = 10; a(2) = 11; for n > 2, a(n) is the smallest number of the form prime + 8 not already used which shares a factor with a(n-1).

Original entry on oeis.org

10, 11, 55, 15, 21, 27, 39, 13, 91, 49, 105, 25, 45, 51, 69, 75, 81, 87, 111, 37, 259, 147, 117, 135, 115, 145, 165, 121, 187, 231, 159, 171, 19, 247, 285, 175, 189, 201, 67, 469, 301, 315, 205, 235, 265, 325, 345, 207, 219, 237, 79, 1027, 429, 249, 279, 31
Offset: 1

Views

Author

Vladimir Shevelev, Apr 20 2015

Keywords

Comments

Analog of EKG-sequence (A064413) on the numbers of the form prime + 8.
Conjecture: the sequence {a(n)-8} is a permutation of primes (A000040).

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{o = 2^3, s, p, k}, s = {o + 2, o + 3}; For[k = 3, k <= n, k++, p = 2; While[GCD[p + o, s[[k - 1]]] == 1 || MemberQ[s, p + o], p = NextPrime@ p]; AppendTo[s, p + o]]; s]; f@ 56 (* Michael De Vlieger, Apr 20 2015 *)

Extensions

More terms from Peter J. C. Moses, Apr 20 2015

A257314 a(1) = 18; a(2) = 19; for n > 2, a(n) is the smallest number of the form prime + 16 not already used which shares a factor with a(n-1).

Original entry on oeis.org

18, 19, 57, 21, 27, 33, 39, 45, 35, 63, 69, 23, 207, 75, 87, 29, 435, 95, 105, 77, 99, 117, 123, 129, 147, 119, 153, 165, 125, 155, 195, 143, 209, 285, 183, 189, 213, 243, 249, 83, 1079, 273, 245, 215, 255, 267, 89, 623, 287, 329, 47, 893, 323, 399, 279, 297
Offset: 1

Views

Author

Vladimir Shevelev, Apr 20 2015

Keywords

Comments

Analog of EKG-sequence (A064413) on the numbers of the form prime + 16.
Conjecture: the sequence {a(n)-16} is a permutation of primes (A000040).

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{o = 16, s, p, k}, s = {o + 2, o + 3}; For[k = 3, k <= n, k++, p = 2; While[GCD[p + o, s[[k - 1]]] == 1 || MemberQ[s, p + o], p = NextPrime@ p]; AppendTo[s, p + o]]; s]; f@ 56 (* Michael De Vlieger, Apr 20 2015 *)

Extensions

More terms from Peter J. C. Moses, Apr 20 2015

A257405 For n=1 or prime, a(n)=n; otherwise, a(n) is the smallest number not already used which shares a factor with a(n-1).

Original entry on oeis.org

1, 2, 3, 6, 5, 10, 7, 14, 4, 8, 11, 22, 13, 26, 12, 9, 17, 34, 19, 38, 16, 18, 23, 46, 20, 15, 21, 24, 29, 58, 31, 62, 28, 30, 25, 35, 37, 74, 32, 36, 41, 82, 43, 86, 40, 42, 47, 94, 44, 33, 27, 39, 53, 106, 48, 45, 50, 52, 59, 118, 61, 122, 54, 51, 57, 60, 67
Offset: 1

Views

Author

Vladimir Shevelev, Apr 22 2015

Keywords

Comments

Since limsup(prime(n)) is infinity, it is easy to see that the sequence contains all even numbers. So it is natural to conjecture that the sequence is a permutation of the positive integers.

Crossrefs

Programs

  • Mathematica
    seq={1};Do[cmplSeq=Complement[Range[2*Max[seq]],seq];
    If[PrimeQ[n],AppendTo[seq,n],AppendTo[seq,Min[Select[cmplSeq,GCD[Last[seq],#]>1&]]]],{n,2,100}];seq (* Ivan N. Ianakiev, Apr 25 2015 *)

Extensions

More terms from Peter J. C. Moses, Apr 22 2015
Showing 1-6 of 6 results.