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

A239965 Where the n-th nonprime occurs in the nonprime EKG sequence A240024.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Apr 30 2014

Keywords

Comments

A240024(a(n)) = A018252(n);
a permutation of the natural numbers with inverse A238862: a(A238862(n))=A238862(a(n))=n.

Crossrefs

Cf. A239943 (fixed points).

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a239965 = (+ 1) . fromJust . (`elemIndex` a240024_list) . a018252

A276374 Numbers n such that A240024(n) = A002808(n).

Original entry on oeis.org

5, 6, 8, 13, 14, 24, 26, 31, 32, 34, 51, 54, 57, 62, 69, 82, 83, 93, 99, 113, 114, 119, 125, 132, 133, 139, 143, 145, 151, 161, 165, 181, 182, 192, 195, 212, 217, 219, 224, 233, 266, 282, 293, 295, 304, 311, 312, 318, 325, 338, 354, 364, 369, 375, 376, 382
Offset: 1

Views

Author

Peter Kagey, Aug 31 2016

Keywords

Crossrefs

Programs

  • Haskell
    a276374 n = a276374_list !! (n - 1)
    a276374_list = filter (\i -> a240024 i == a002808 i) [1..]
  • Mathematica
    c = Select[Range@ 500, CompositeQ]; a = {1, 4}; Do[k = 6; While[Or[PrimeQ@ k, MemberQ[a, k], CoprimeQ[a[[i - 1]], k]], k++]; AppendTo[a, k], {i, 3, Length@ c}]; Flatten@ Position[Union /@ Transpose@ {a, c}, w_ /; Length@ w == 1] (* Michael De Vlieger, Sep 01 2016 *)

A276375 Numbers n such that A240024(n + 1) = A002808(n).

Original entry on oeis.org

1, 2, 3, 11, 22, 29, 47, 49, 52, 67, 78, 79, 80, 91, 103, 104, 109, 111, 121, 130, 137, 148, 152, 159, 179, 184, 190, 200, 207, 215, 222, 241, 264, 278, 291, 307, 309, 316, 331, 336, 343, 347, 350, 361, 373, 380, 400, 409, 415, 430, 435, 445, 450, 453, 468
Offset: 1

Views

Author

Peter Kagey, Aug 31 2016

Keywords

Crossrefs

Programs

  • Haskell
    a276375 n = a276375_list !! (n - 1)
    a276375_list = filter (\i -> a240024 (i + 1) == a002808 i) [1..]
  • Mathematica
    c = Select[Range@ 600, CompositeQ]; a = {1, 4}; Do[k = 6; While[Or[PrimeQ@ k, MemberQ[a, k], CoprimeQ[a[[i - 1]], k]], k++]; AppendTo[a, k], {i, 3, Length@c + 1}]; Flatten@ Position[Union /@ Transpose@ {Rest@ a, c}, w_ /; Length@ w == 1] (* Michael De Vlieger, Sep 01 2016 *)

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

A075570 Lexicographically earliest sequence of distinct composite numbers such that a(k) + a(k+1) is prime for all k.

Original entry on oeis.org

4, 9, 8, 15, 14, 27, 10, 21, 16, 25, 6, 35, 12, 49, 18, 55, 24, 65, 32, 39, 20, 33, 26, 45, 22, 51, 28, 69, 34, 63, 38, 75, 52, 57, 40, 87, 44, 93, 46, 81, 50, 77, 30, 119, 48, 91, 36, 95, 42, 85, 54, 125, 56, 111, 62, 105, 58, 99, 64, 115, 66, 133, 60, 121, 70, 123, 68, 129, 82
Offset: 1

Views

Author

Amarnath Murthy, Sep 25 2002

Keywords

Comments

Index of composite values: {1, 4, 3, 8, 7, 17, 5, 12, 9, 15, 2, 23, 6, 33, 10, 38, 14, 46, 20, 26, 11, 21, 16, 30, ...}. - Michael De Vlieger, Jul 18 2017

Crossrefs

Programs

  • Mathematica
    a = {4}; Do[k = 2 - Boole@ EvenQ@ n; While[Nand[! MemberQ[a, k], CompositeQ@ k, PrimeQ[a[[n - 1]] + k]], k += 2]; AppendTo[a, k], {n, 2, 69}]; a (* Michael De Vlieger, Jul 18 2017 *)

Extensions

More terms from David Wasserman, Jan 20 2005
Definition clarified by Peter Munn, Jul 20 2017

A085084 Smallest number not yet used which is not a prime but is relatively prime to the previous term.

Original entry on oeis.org

1, 4, 9, 8, 15, 14, 25, 6, 35, 12, 49, 10, 21, 16, 27, 20, 33, 26, 45, 22, 39, 28, 51, 32, 55, 18, 65, 24, 77, 30, 91, 34, 57, 40, 63, 38, 69, 44, 75, 46, 81, 50, 87, 52, 85, 36, 95, 42, 115, 48, 119, 54, 121, 56, 93, 58, 99, 62, 105, 64, 111, 68, 117, 70, 123, 74, 125, 66
Offset: 1

Views

Author

Amarnath Murthy, Jul 02 2003

Keywords

Comments

Every composite number appears in this sequence. Eventually, every p^2 (p prime) will appear; if the smallest unused composite does not follow, it will appear no later than following the next p^2.

Crossrefs

Sequences with related definitions: A051884, A064413, A075570, A163642, A240024.
Cf. A000027.

Programs

  • Haskell
    import Data.List (find, delete)
    import Data.Maybe (fromJust)
    a085084 n = a085084_list !! (n-1)
    a085084_list = 1 : f 1 a002808_list where
       f x cs = y : f y (delete y cs) where
                y = fromJust $ find ((== 1) . (gcd x)) cs
    -- Reinhard Zumkeller, Dec 01 2012
  • Maple
    # Corrected Maple program from Chen Zekai, Mar 23 2015, added by N. J. A. Sloane, Mar 23 2015
    A085084 := proc (q) local a, b, i, n;if q = 1 then print(1); return;elif q = 2 then print(1); print(4); return;fi;a := {1, 4}; b := 4; i := 2; print(1); print(4);while i < q do for n from 6 to q^2 doif not isprime(n) and gcd(b, n) = 1 and {} = a intersect {n} thenb := n; a := a union {n}; i := i+1; print(n);break;fi; od; od; end:A085084(10000):
  • Mathematica
    A085084 = {a[1]=1, a[2]=4}; a[n_] := a[n] = Catch[For[k = 6, True, k++, If[!PrimeQ[k] && !MemberQ[A085084, k] && CoprimeQ[a[n-1], k], AppendTo[A085084, k]; Throw[k]]]]; Table[ a[n], {n, 1, 68}] (* Jean-François Alcover, Jul 17 2012 *)

Extensions

Corrected and extended by Vladeta Jovovic, Jul 05 2003
Additional comments from Franklin T. Adams-Watters, Sep 19 2006
Edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar

A238862 Inverse permutation to A239965.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 5, 9, 11, 8, 10, 12, 14, 15, 13, 18, 20, 16, 24, 19, 17, 21, 23, 25, 22, 27, 29, 26, 28, 30, 32, 33, 31, 35, 37, 38, 36, 41, 43, 39, 47, 51, 34, 40, 42, 44, 46, 48, 45, 50, 52, 49, 53, 55, 57, 54, 58, 60, 61, 56, 65, 63, 66, 59, 64, 69, 72
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 30 2014

Keywords

Comments

a(A239965(n)) = A239965(a(n)) = n;
A018252(a(n)) = A240024(n).

Crossrefs

Cf. A239943 (fixed points).

Programs

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

A352097 a(1) = 4, a(2) = 9; let i = a(n-2) and j = a(n-1); a(n) = least k not already in the sequence such that gcd(j, k) = 1 and 1 < gcd(i, k) != i != k.

Original entry on oeis.org

4, 9, 10, 21, 8, 15, 14, 25, 6, 35, 16, 45, 22, 27, 20, 33, 26, 51, 28, 39, 32, 57, 34, 63, 38, 49, 12, 77, 18, 55, 24, 65, 36, 85, 42, 95, 44, 75, 46, 81, 40, 69, 50, 87, 52, 93, 56, 99, 58, 105, 62, 91, 30, 119, 48, 133, 54, 161, 60, 203, 64, 145, 66, 115, 68
Offset: 1

Views

Author

Michael De Vlieger, Jun 03 2022

Keywords

Comments

Variant of A098550 analogous to A240024 and its relationship to A064413.
Theorem: the sequence is in composites. Proof: Prime k must either divide or be coprime to i, but 1 < gcd(i, k) != k precludes k | i. Therefore there is no avenue for primes in the sequence.
All i and k must have an "unrelated" (neither coprime nor divisor, i.e., neutral) relationship in the sense of A045763.
Theorem: if prime p | j then p does not divide k. Consequence of coprimality axiom gcd(j, k) = 1. Hence, even terms are nonadjacent in the sequence. Therefore we begin this sequence with {4, 9}.
A version of Yellowstone sequence S = A098550 that strips out features attributable to prime S(n) and their cototient successors S(n+2). In S, those 2 groups produce quasi-rays in scatterplot that have primes appear late and their successors early in S.
Composite quasi-rays in the Yellowstone sequence scatterplot are retained, bifurcated according to parity for same reasons as in that sequence.
Conjecture: permutation of the composite numbers.

Crossrefs

Programs

  • Mathematica
    c[_] = 0; MapIndexed[Set[{a[First[#2]], c[#1]}, {#1, First[#2]}] &, {4, 9}]; Set[{i, j, u, nn}, {a[1], a[2], 6, 120}]; Do[k = u; While[Nand[c[k] == 0, And[# > 1, # != i, # != k] &@ GCD[i, k], CoprimeQ[j, k]], k++]; Set[{a[n], c[k], i, j}, {k, n, j, k}]; If[k == u, While[Nand[c[u] == 0, CompositeQ[u]], u++]], {n, 3, nn}]; Array[a, nn]
Showing 1-8 of 8 results.