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-10 of 17 results. Next

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

A353989 a(1) = 1; a(2) = 3; for n > 2, a(n) is the smallest positive number that has not appeared that shares a factor with a(n-1) and whose binary expansion has a 1-bit in common with the binary expansion of a(n-1).

Original entry on oeis.org

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

Views

Author

Scott R. Shannon, May 13 2022

Keywords

Comments

This sequence is similar to the EKG sequence A064413 with the additional restriction that each term must share at least one 1-bit in common with the previous term in their binary expansions. The majority of terms are concentrated along the same three lines as in A064413 although at least three additional lines appear that contains fewer terms. See the linked image. Unlike A064413 the primes do not occur in their natural order and a prime p can be preceded and followed by multiples of p other than 2p and 3p respectively.
In the first 100000 terms the fixed points are 1, 16, 32, 209, 527, and it is likely no more exist. In the same range the lowest unseen number is 34849; the sequence is conjectured to be a permutation of the positive integers.
See A353245 for the binary AND operation of each pair of terms.

Examples

			a(3) = 6 as a(2) = 3, 6 = 110_2, 3 = 11_2, and 6 is the smallest unused number that shares a common factor with 3 and has a 1-bit in common with 3 in their binary expansions.
		

Crossrefs

A352763 a(1) = 1; a(2) = 2; for n > 2, a(n) is the smallest positive number that has not appeared that shares a factor with a(n-1) and whose binary expansion has no 1-bit in common with the binary expansion of a(n-1).

Original entry on oeis.org

1, 2, 4, 8, 6, 9, 18, 12, 3, 24, 32, 10, 5, 40, 16, 14, 48, 15, 80, 34, 17, 68, 26, 36, 27, 96, 20, 35, 28, 64, 22, 33, 30, 65, 50, 72, 21, 42, 69, 138, 52, 66, 44, 82, 41, 656, 38, 88, 128, 46, 144, 39, 192, 45, 130, 13, 208, 256, 54, 129, 60, 194, 56, 7, 112, 132, 11, 176, 70, 25, 100, 136, 51
Offset: 1

Views

Author

Scott R. Shannon, May 15 2022

Keywords

Comments

This sequence is similar to the EKG sequence A064413 with the additional restriction that no term can have a 1-bit in common with the previous term in their binary expansions. These restrictions lead to numerous terms being much larger than their preceding term, while the smaller terms overall show similar behavior to A109812. See the linked image. Unlike A064413 the primes do not occur in their natural order and the term following a prime can be a very large multiple of the prime.
In the first 50000 terms the fixed points are 1, 2, 105, 135, 225, 2157, 3972, 7009, 8531, although it is likely more exist. In the same range the lowest unseen number is 383; the sequence is conjectured to be a permutation of the positive integers.

Examples

			a(5) = 6 as a(4) = 8, 6 = 110_2, 8 = 1000_2, and 6 is the smallest unused number that shares a common factor with 8 but has no 1-bit in common with 8 in their binary expansions.
		

Crossrefs

A354087 a(1) = 1; for n > 1, a(n) is the smallest positive number that has not yet appeared that shares a factor with a(n-1) and whose binary expansion has a single 1-bit in common with the binary expansion of a(n-1).

Original entry on oeis.org

1, 3, 6, 2, 10, 8, 12, 4, 14, 18, 15, 20, 5, 25, 35, 21, 9, 24, 16, 22, 11, 33, 27, 48, 26, 13, 52, 32, 34, 30, 36, 28, 7, 42, 49, 77, 56, 38, 19, 133, 57, 69, 46, 66, 39, 65, 45, 50, 40, 54, 68, 44, 70, 58, 72, 60, 74, 64, 76, 80, 55, 88, 96, 51, 78, 81, 102, 130, 62, 132, 63, 129, 43, 86, 104, 82
Offset: 1

Views

Author

Scott R. Shannon, May 17 2022

Keywords

Comments

This sequence is similar to the EKG sequence A064413 with the additional restriction that each term must share a single 1-bit in common with the previous term in their binary expansions. These restrictions lead to numerous terms being significantly larger than their preceding term, while the smaller terms overall show similar behavior to A109812. See the linked image. Unlike A064413 the primes do not occur in their natural order and both the proceeding and following terms of the primes can be large multiples of the prime.
In the first 100000 terms the fixed points are 1, 3, 30, 38, 350, 1603, 1936, 10176, 11976, 46123, 58471, 89870, although it is likely more exist. In the same range the lowest unseen number is 1019; the sequence is conjectured to be a permutation of the positive integers.

Examples

			a(6) = 8 as a(5) = 10, 8 = 1000_2, 10 = 1010_2, and 8 is the smallest unused number that shares a common factor with 10 and has a single 1-bit in common with 10 in their binary expansions. Note that 4 satisfies the first criterion but not the second.
		

Crossrefs

A382702 Indices k where b(k) > k, where b is the EKG sequence A064413.

Original entry on oeis.org

3, 4, 6, 7, 9, 11, 12, 13, 15, 16, 18, 19, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 34, 35, 36, 38, 39, 41, 42, 44, 45, 46, 47, 48, 49, 51, 52, 53, 54, 55, 56, 58, 59, 60, 62, 63, 65, 66, 68, 69, 70, 71, 72, 73, 75, 76, 77, 79, 80, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 106, 108
Offset: 1

Views

Author

N. J. A. Sloane, Apr 04 2025

Keywords

Examples

			A064413(3) = 4 > 3, so 3 is a term.
		

Crossrefs

A382708 Number of triples (i,j,k), 1 <= i < j < k <= n such that A064413(i) < A064413(k) < A064413(j).

Original entry on oeis.org

0, 0, 0, 0, 4, 4, 4, 14, 20, 39, 39, 39, 59, 97, 97, 97, 134, 162, 177, 260, 260, 280, 300, 360, 360, 423, 525, 694, 694, 722, 817, 895, 1129, 1129, 1162, 1254, 1546, 1546, 1615, 1751, 1856, 1925, 2326, 2326, 2436, 2546, 2625, 2704, 2783, 3061, 3104, 3196, 3415, 3458, 3458, 3699, 4439, 4439, 4590, 4890, 5725, 5725, 5842
Offset: 1

Views

Author

N. J. A. Sloane, Apr 04 2025

Keywords

Comments

This is the number of occurrences of the pattern "132" in the first n terms of A064413.

Examples

			The first 5 terms of A064413 are 1, 2, 4, 6, 3, and at that point we can see four occurrences of the pattern "132", namely the triples 143, 163, 243, and 263, so a(5) = 4.
		

Crossrefs

A247379 a(n) = gcd(EKG(n),n) with EKG = A064413.

Original entry on oeis.org

1, 2, 1, 2, 1, 3, 1, 8, 1, 5, 1, 6, 1, 7, 3, 8, 1, 2, 1, 1, 3, 1, 1, 1, 5, 2, 1, 1, 1, 6, 1, 2, 1, 17, 7, 2, 1, 19, 3, 40, 1, 2, 1, 1, 3, 2, 1, 6, 7, 1, 3, 4, 1, 1, 5, 2, 1, 29, 1, 2, 1, 31, 9, 64, 1, 2, 1, 1, 3, 2, 1, 8, 1, 1, 3, 1, 7, 1, 1, 2, 1, 1, 1, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 15 2014

Keywords

Comments

a(n) = gcd(A064413(n),n);
a(A247383(n)) = n and a(m) != n for m < A247383(n).

Crossrefs

Cf. A064413, A152458 (fixed points), A247383.

Programs

  • Haskell
    a247379 n = gcd n $ a064413 n

A065519 a(n) = A064413(n)-n.

Original entry on oeis.org

0, 0, 1, 2, -2, 3, 5, 0, 1, -5, 4, 6, 1, -7, 6, 8, -1, 2, 3, -9, 12, 5, 7, 1, 10, 2, -1, -15, 10, 6, 1, 2, -16, 17, 7, 2, -18, 19, 6, 0, 3, 4, -20, 25, 3, 4, 5, 6, 7, -1, 12, 8, 2, 11, 15, 2, -28, 29, 7, 2, -30, 31, 9, 0, 3, 8, -30, 43, 6, 8, 5, 8, 9
Offset: 1

Views

Author

N. J. A. Sloane, Nov 28 2001

Keywords

Comments

Zeros appear at A152458.

Crossrefs

Programs

  • Mathematica
    terms = 100;
    ekg[s_] := Block[{m = s[[-1]], k = 3}, While[MemberQ[s, k] || GCD[m, k] == 1, k++]; Append[s, k]];
    Nest[ekg, {1, 2}, terms-2] - Range[terms] (* Jean-François Alcover, Sep 10 2018, after Robert G. Wilson v *)

A379292 Number k such that A379248(k) = k.

Original entry on oeis.org

1, 2, 33, 155, 913, 1145
Offset: 1

Views

Author

Scott R. Shannon, Dec 20 2024

Keywords

Comments

These are the fixed points in the first 500000 terms of A379248. See that sequence for further details.

Crossrefs

A382703 Numbers k which appear "prematurely" in A064413, that is, k appears before the k-th term.

Original entry on oeis.org

4, 6, 9, 12, 10, 15, 18, 14, 21, 24, 20, 22, 33, 27, 30, 25, 35, 28, 39, 36, 32, 34, 51, 42, 38, 57, 45, 44, 46, 69, 48, 50, 52, 54, 56, 63, 60, 55, 65, 70, 58, 87, 66, 62, 93, 72, 68, 74, 111, 75, 78, 76, 80, 82, 123, 81, 84, 88, 86, 129, 90, 85, 95, 100, 92, 94, 141, 96, 98, 104, 102, 99, 105, 108, 106, 159, 114, 110, 112, 116
Offset: 1

Views

Author

N. J. A. Sloane, Apr 04 2025

Keywords

Comments

a(n) = A064413(A382702(n)).

Examples

			4 appears in A064413 at the third term, so 4 is a term.
		

Crossrefs

Showing 1-10 of 17 results. Next