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.

A256918 Greatest common divisors of adjacent terms in A257218.

Original entry on oeis.org

1, 1, 3, 2, 4, 2, 5, 5, 3, 9, 6, 4, 8, 6, 10, 20, 8, 16, 12, 9, 27, 18, 12, 15, 15, 25, 25, 10, 7, 7, 14, 14, 21, 21, 63, 42, 28, 56, 16, 32, 24, 40, 20, 50, 30, 18, 27, 81, 54, 72, 24, 28, 35, 35, 105, 30, 45, 45, 75, 100, 40, 32, 64, 48, 48, 36, 63, 189
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 25 2015

Keywords

Comments

a(n) = GCD(A257218(n),A257218(n+1)).
Each term occurs at most twice, and it is a plausible conjecture that every term will occur exactly twice.
A257120(n) = position of the first of not more than two occurrences of n: a(A257120(n)) = n;
A257475(n) = position of the second and last occurrence of n: a(A257475(n)) = n;
A257478(n) = distance of positions of first and second occurrence of n.

Crossrefs

Programs

  • Haskell
    a256918 n = a257218_list !! (n-1)
    a256918_list = zipWith gcd a257218_list $ tail a257218_list

A257122 Smallest m such that A257218(m) = n.

Original entry on oeis.org

1, 2, 3, 5, 8, 4, 30, 6, 10, 7, 123, 12, 201, 31, 9, 13, 300, 11, 825, 16, 34, 124, 946, 14, 27, 202, 21, 32, 3094, 15, 7060, 18, 127, 301, 54, 20, 13528, 826, 205, 17, 28659, 33, 40811, 125, 25, 947, 46658, 19, 81, 28, 304, 203, 57450, 22, 134, 38, 829, 3095
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 25 2015

Keywords

Comments

A257218(a(n)) = n and A257218(m) != n for m < a(n);
it appears that all records > 8 occur at primes;
for p prime: a(p)-1 = index of the smallest multiple of p in A257218.

Crossrefs

Cf. A257218.

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a257122 = (+ 1) . fromJust . (`elemIndex` a257218_list)

Extensions

a(41)-a(58) from Hiroaki Yamanouchi, May 04 2015

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

A257120 Position of first occurrence of n in A256918.

Original entry on oeis.org

1, 4, 3, 5, 7, 11, 29, 13, 10, 15, 122, 19, 200, 31, 24, 18, 299, 22, 824, 16, 33, 124, 945, 41, 26, 202, 21, 37, 3093, 45, 7059, 40, 126, 301, 53, 66, 13527, 826, 204, 42, 28658, 36, 40810, 130, 57, 947, 46657, 64, 80, 44, 303, 208, 57449, 49, 133, 38, 828
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 25 2015

Keywords

Comments

A256918(a(n)) = n and A256918(m) != n for m < a(n);
GCD(A257218(a(n)),A257218(a(n)+1)) = n;
if A257218 is a permutation, then also this sequence is a permutation;
a(n) < A257475(n); a(n) = A257475(n) - A257478(n).
a(n) >= A257122(n)-1. - Ivan Neretin, May 02 2015

Examples

			See A257478.
		

Crossrefs

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a257120 = (+ 1) . fromJust . (`elemIndex` a256918_list)

Extensions

a(41)-a(57) from Hiroaki Yamanouchi, May 03 2015

A257475 Position of second and last occurrence of n in A256918.

Original entry on oeis.org

2, 6, 9, 12, 8, 14, 30, 17, 20, 28, 123, 23, 201, 32, 25, 39, 300, 46, 825, 43, 34, 125, 946, 51, 27, 203, 47, 52, 3094, 56, 7060, 62, 127, 302, 54, 71, 13528, 827, 205, 61, 28659, 79, 40811, 132, 58, 948, 46658, 65, 81, 99, 304, 210, 57450, 69, 134, 77, 829
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 25 2015

Keywords

Comments

GCD(A257218(a(n)),A257218(a(n)-1)) = n;
a(n) > A257120(n); a(n) = A257120 + A257478(n).

Examples

			Cf. A257478.
		

Crossrefs

Programs

  • Haskell
    a257475 n = f 1 a256918_list where
       f i (u:us) = (if u == n then g else f) (i + 1) us
       g j (v:vs) =  if v == n then j else g  (j + 1) vs

Extensions

a(38)-a(57) from Hiroaki Yamanouchi, May 03 2015

A257478 Distance of positions of first and last occurrence of n in A256918.

Original entry on oeis.org

1, 2, 6, 7, 1, 3, 1, 4, 10, 13, 1, 4, 1, 1, 1, 21, 1, 24, 1, 27, 1, 1, 1, 10, 1, 1, 26, 15, 1, 11, 1, 22, 1, 1, 1, 5, 1, 1, 1, 19, 1, 43, 1, 2, 1, 1, 1, 1, 1, 55, 1, 2, 1, 20, 1, 39, 1, 1, 1, 13, 1, 1, 32, 42, 1, 11, 1, 2, 1, 67, 1, 26
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 25 2015

Keywords

Comments

a(n) = A257475(n) - A257120(n).

Examples

			Let w(n) = A257218(n),
u(n) = A257120(n), xx'(n) = (w(u(n)),w(u(n)+1)),
v(n) = A257475(n), yy'(n) = (w(v(n)),w(v(n)+1)):
. ----+------+------+------++--------------+------------+---------+
.   n | a(n) | u(n) | v(n) ||       xx'(n) |     yy'(n) | ... gcd |
. ----+------+------+------++--------------+------------+---------+
.   1 |    1 |    1 |    2 ||     (1,   2) |   (2,   3) |       1 |
.   2 |    2 |    4 |    6 ||     (6,   4) |   (8,  10) |       2 |
.   3 |    6 |    3 |    9 ||     (3,   6) |  (15,   9) |       3 |
.   4 |    7 |    5 |   12 ||     (4,   8) |  (12,  16) |       4 |
.   5 |    1 |    7 |    8 ||    (10,   5) |   (5,  15) |       5 |
.   6 |    3 |   11 |   14 ||    (18,  12) |  (24,  30) |       6 |
.   7 |    1 |   29 |   30 ||    (70,   7) |   (7,  14) |       7 |
.   8 |    4 |   13 |   17 ||    (16,  24) |  (40,  32) |       8 |
.   9 |   10 |   10 |   20 ||     (9,  18) |  (36,  27) |       9 |
.  10 |   13 |   15 |   28 ||    (30,  20) |  (50,  70) |      10 |
.  11 |    1 |  122 |  123 ||   (660,  11) |  (11,  22) |      11 |
.  12 |    4 |   19 |   23 ||    (48,  36) |  (72,  60) |      12 |
.  13 |    1 |  200 |  201 ||  (1092,  13) |  (13,  26) |      13 |
.  14 |    1 |   31 |   32 ||    (14,  28) |  (28,  42) |      14 |
.  15 |    1 |   24 |   25 ||    (60,  45) |  (45,  75) |      15 |
.  16 |   21 |   18 |   39 ||    (32,  48) | (112,  64) |      16 |
.  17 |    1 |  299 |  300 ||  (2142,  17) |  (17,  34) |      17 |
.  18 |   24 |   22 |   46 ||    (54,  72) |  (90, 108) |      18 |
.  19 |    1 |  824 |  825 || (10260,  19) |  (19,  38) |      19 |
.  20 |   27 |   16 |   43 ||    (20,  40) |  (80, 100) |      20 |
.  21 |    1 |   33 |   34 ||    (42,  21) |  (21,  63) |      21 |
.  22 |    1 |  124 |  125 ||    (22,  44) |  (44,  66) |      22 |
.  23 |    1 |  945 |  946 || (12420,  23) |  (23,  46) |      23 |
.  24 |   10 |   41 |   51 ||    (96, 120) | (144, 168) |      24 |
.  25 |    1 |   26 |   27 ||    (75,  25) |  (25,  50) |      25 | .
		

Crossrefs

Programs

  • Haskell
    a257478 n = a257475 n - a257120 n

Extensions

a(37)-a(72) from Hiroaki Yamanouchi, May 03 2015

A384308 a(1) = 3; for n > 1, a(n) is the smallest number that has not appeared before and has the same set of prime divisors as a(n-1) + 1.

Original entry on oeis.org

3, 2, 9, 10, 11, 6, 7, 4, 5, 12, 13, 14, 15, 8, 27, 28, 29, 30, 31, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 81, 82, 83, 42, 43, 44, 45, 46, 47, 36, 37, 38, 39, 40, 41, 84, 85, 86, 87, 88, 89, 60, 61, 62, 63, 32, 33, 34, 35, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 90, 91, 92, 93, 94, 95, 72, 73, 74, 75
Offset: 1

Views

Author

SiYang Hu, May 25 2025

Keywords

Comments

Theorem 1: {a(n)} is a permutation of the positive integers greater than 1.
Proof: Suppose the smallest positive integer greater than 1 that does not appear in this sequence is m, whose set of prime divisors is {p1, p2, ..., pk}. Since there are infinitely many numbers with this set of prime divisors, we know that either all of them appear or none of them appear. Since m is the smallest among them, we know that m = p1*p2*...*pk. Therefore, p1*p2*...*pk - 1 does not appear, a contradiction, implying that all integers greater than one appear in {a(n)}. Since there are no repetitions by the definition, we have proven that {a(n)} is a permutation of the positive integers greater than 1.
From Yifan Xie, May 26 2025: (Start)
Theorem 2: The parity of a(n) is the same as the parity of n.
Proof: Since a(1) is odd, we only need to prove that an odd term is immediately followed by an even term, and an even term is immediately followed by an odd term. If a(n-1) is odd, the set of prime divisors of a(n-1) + 1 contains 2, so a(n) is even; If a(n-1) and a(n) are both even, the set of prime divisors of a(n-1) + 1 does not contain 2, so a(n)/2 is a smaller candidate for a(n), a contradiction. (End)

Examples

			For a(5) = 11, 11 + 1 = 12, its set of prime divisors is {2, 3}. The smallest number with the same set of prime divisors that has not appeared before is 6, so a(6) = 6.
		

Crossrefs

Similar to A064413 and A257218.

Programs

  • Maple
    N:= 1000:# for terms before the first term > N
    for i from 2 to N do
      S:= numtheory:-factorset(i);
      if assigned(V[S]) then V[S]:= V[S] union {i}
      else V[S]:= {i}
      fi
    od:
    R:= 3: r:= 3: V[{3}]:= V[{3}] minus {3}:
    while r < N do
      S:= numtheory:-factorset(r+1);
      if V[S] = {} then break fi;
      r:= min(V[S]);
      V[S]:= V[S] minus {r};
      R:= R, r;
    od:
    R; # Robert Israel, May 25 2025
  • Mathematica
    s={3};Do[i=2;While[MemberQ[s,i]||First/@FactorInteger[i]!=First/@FactorInteger[s[[-1]]+1],i++];AppendTo[s,i],{n,2,81}];s (* James C. McMahon, Jun 04 2025 *)
  • Python
    import heapq
    from math import prod
    from sympy import factorint
    from itertools import islice
    def bgen(pset): # generator of terms with set of prime divisors = pset
        h = [prod(pset)]
        while True:
            v = heapq.heappop(h)
            yield v
            for p in pset:
                heapq.heappush(h, v*p)
    def agen(): # generator of terms
        an, aset = 3, set()
        while True:
            yield an
            aset.add(an)
            an = next(m for m in bgen(set(factorint(an+1))) if m not in aset)
    print(list(islice(agen(), 81))) # Michael S. Branicky, May 25 2025
Showing 1-7 of 7 results.