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.

Previous Showing 31-40 of 54 results. Next

A338338 Lexicographically earliest infinite sequence of distinct positive numbers such that for any prime p, any run of consecutive multiples of p has length exactly 3.

Original entry on oeis.org

1, 2, 4, 6, 3, 9, 5, 10, 20, 8, 7, 14, 28, 12, 15, 30, 40, 16, 11, 22, 44, 18, 21, 42, 56, 24, 27, 33, 55, 110, 50, 26, 13, 39, 36, 48, 32, 17, 34, 68, 38, 19, 57, 45, 60, 70, 84, 63, 51, 85, 170, 80, 46, 23, 69, 54, 66, 88, 77, 35, 105, 75, 72, 52, 78, 117
Offset: 1

Views

Author

N. J. A. Sloane, Oct 27 2020

Keywords

Comments

If a prime p divides a(n), then there is a run of exactly three terms (one of which is a(n)) that are divisible by p.
If "three" is changed to "two", we get A280864.
Conjecture: This is a permutation of the positive integers.

Examples

			After 1,2,4,6,3, we have had two successive multiples of 3, so the next term must be a multiple of 3 we have not yet seen, hence 9. The following term is then the smallest number not yet seen which is not a multiple of 3, hence 5.
		

Crossrefs

A338339-A338349, A338440, A338449, A338450, and A338451 analyze this sequence from various points of view.

Programs

  • PARI
    See Links section.

Extensions

Corrected and extended by Rémy Sigrist, Oct 27 2020

A280866 Lexicographically earliest sequence of distinct terms such that, for any prime p, any run of consecutive multiples of p has at least length 2.

Original entry on oeis.org

1, 2, 4, 3, 6, 8, 5, 10, 12, 9, 7, 14, 16, 11, 22, 18, 15, 20, 24, 21, 28, 26, 13, 17, 34, 30, 45, 19, 38, 32, 23, 46, 36, 27, 25, 35, 42, 48, 29, 58, 40, 50, 31, 62, 44, 33, 39, 52, 54, 51, 68, 56, 49, 37, 74, 60, 75, 41, 82, 64, 43, 86, 66, 99, 47, 94, 70
Offset: 1

Views

Author

Rémy Sigrist, Jan 09 2017

Keywords

Comments

In other words, each multiple of a prime p has at least one neighbor that is also a multiple of p.
This sequence is similar to A280864; the first difference oocurs at n=42: a(42)=50 whereas A280864(42)=55.
Conjectured to be a permutation of the natural numbers.
Comment from N. J. A. Sloane, Jan 14 2017, with minor edits May 08 2024: (Start)
Theorem: This is a permutation of the natural numbers.
Proof. 1. By definition no term is repeated.
2. The sequence is clearly infinite, since we can always use a very large prime G to build the next term. (G*a(n) is always a candidate for a(n+1).)
3. So for any integer m, either it appears in the sequence, or there is an n_0 such that for n > n_0, a(n) > m. (Let w(m) = index where m appears, or -1 if m does not appear. Let W(m) = max{w(i): 1 <= i <= m}. Then for n > W(m), a(n) > m.)
4. For any prime p, there is a term a(n) that is divisible by p. For if not, no prime greater than p can appear either, or we could have used p instead. This would mean all terms are products of the primes less than p. Go out a long way in the sequence until the terms exceed p!. Then one of the finite set of numbers p times {a possibly empty product of distinct primes less than p} will be a smaller candidate for the next term. So p will appear. Contradiction.
5. Call a(n) free if all its prime factors already appeared in a(n-1). If a(n) is free then there are no constraints on a(n+1) and so a(n+1) will be the smallest number not yet in the sequence.
6. For a prime p, let a(n) be the first term divisible by p. Either a(n) = k*p, where k is a product of the distinct primes needed to link a(n) to a(n-1), in which case a(n+1) = p and is free; or else a(n) = p, in which case a(n-1) was free. So in either case there is a free term associated with the prime p. (Except if there are two consecutive primes, like 13 and 17, when we only get one free term, not two. We will ignore this complication! There cannot be three consecutive primes.)
7. Since there are infinitely many primes, the sequence contains infinitely many free terms, and so every number will eventually appear. For suppose k never appears. Consider the first free term a(n) > k. Then a(n+1) = k, a contradiction. QED
(End)
The second occurrence of two consecutive primes is at n = 1324 .. 1325: a(1324) = 691, a(1325) = 701. - Antti Karttunen, May 18 2018
Alternative definition: a(1,2) = 1,2 then for n > 2 a(n) is the least novel multiple of rad(a(n-2)*a(n-1))/rad(a(n-2)), where rad is A007947. - David James Sycamore, Jan 27 2024

Examples

			The first terms, alongside their required prime factors are:
n   a(n)  Required
--  ----  --------
1      1  none
2      2  none
3      4  2
4      3  none
5      6  3
6      8  2
7      5  none
8     10  5
9     12  2
10     9  3
11     7  none
12    14  7
13    16  2
14    11  none
15    22  11
16    18  2
17    15  3
18    20  5
19    24  2
20    21  3
21    28  7
22    26  2
23    13  13
24    17  none
25    34  17
26    30  2
27    45  3, 5
28    19  none
29    38  19
30    32  2
31    23  none
32    46  23
33    36  2
34    27  3
35    25  none
36    35  5
37    42  7
38    48  2, 3
39    29  none
40    58  29
41    40  2
42    50  5
		

Crossrefs

Cf. A280864.
Cf. A304741 (inverse permutation), A304742, A304743.
Cf. A007947.

Programs

  • Mathematica
    nn = 1000;
    c[] := False; m[] := 1;
    a[1] = i = 1; a[2] = j = m[1] = m[2] = 2; c[1] = c[2] = True;
    f[x_] := f[x] = Times @@ FactorInteger[x][[All, 1]];
    Do[While[c[Set[k, #  m[#]]], m[#]++] &[f[i  j]/f[i]];
     Set[{a[n], c[k], i, j}, {k, True, j, k}], {n, 3, nn}];
    Array[a, nn] (* Michael De Vlieger, Jan 27 2024 *)
  • PARI
    \\ After Rémy Sigrist's original PARI-program given in Links section:
    up_to = (2^14);
    A007947(n) = factorback(factorint(n)[, 1]);
    v280866 = vector(up_to);
    m304741 = Map(); k=0; prevprev = prev = 1;
    for(n=1,up_to, m = A007947(prev)/A007947(gcd(prev,prevprev)); try = m; while(mapisdefined(m304741,try), try += m); prevprev = prev; prev = try; mapput(m304741,v280866[n] = try,n));
    A280866(n) = v280866[n];
    A304741(n) = mapget(m304741,n); \\ Antti Karttunen, May 18 2018

A283312 a(n) = smallest missing positive number, unless a(n-1) was a prime in which case a(n) = 2*a(n-1).

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, Mar 08 2017

Keywords

Comments

Comments from N. J. A. Sloane, Nov 02 2020: (Start)
Alternatively, this is the lexicographically earliest infinite sequence of distinct positive numbers such that every prime is followed by its double.
Theorem: This is a permutation of the positive integers.
Proof. Sequence is clearly infinite, so for any k there is a number N_0(k) such that n >= N_0(k) implies a(n) > k.
Suppose m is missing. Consider a(n) for n = N_0(m). Then a(n) must be a prime p (otherwise it would have been m, which is missing), a(n+1) = 2*p, and a(n+2) = m, a contradiction. QED.
(End)
A toy model of A280864, A280985, and A127202.
Alternative definition: a(1,2) = 1,2. Let P(k) = rad(a(1)*a(2)*...*a(k)), then for n > 2, a(n) = P(n)/P(n-1), where rad is A007947. - David James Sycamore, Jan 27 2024

Examples

			The offset is 1. What is a(1)? It is the smallest missing positive number, which is 1. Similarly, a(2)=2.
What is a(3)? Since the previous term was the prime 2, a(3) = 4.
And so on.
		

Crossrefs

See A283313 for smallest missing number, A338362 for inverse, A338361 for indices of primes, A338357 for first differences.
For records see A338356 and A001747.

Programs

  • Maple
    a:=[1];
    H:=Array(1..1000,0); MMM:=1000;
    H[1]:=1; smn:=2; t:=2;
    for n from 2 to 100 do
    if t=smn then a:=[op(a),t]; H[t]:=1;
       if isprime(t) then a:=[op(a),2*t]; H[2*t]:=1; fi;
       t:=t+1;
    # update smallest missing number smn
       for i from smn+1 to MMM do if H[i]=0 then smn:=i; break; fi; od;
    else t:=t+1;
    fi;
    od:
    a;
  • Mathematica
    Module[{nmax = 100, smn = 1}, Nest[Append[#, If[PrimeQ[Last[#]], 2*Last[#], While[MemberQ[#, ++smn]]; smn]]&, {1}, nmax-1]] (* Paolo Xausa, Feb 12 2024 *)

Formula

There is an explicit formula for the n-th term of the inverse permutation: see A338362.
The graph: Numbers appear in the sequence in their natural order, except when interrupted by the appearance of primes. Suppose a(n)=x, where x is neither a prime nor twice a prime. Then if p is a prime in the range x/2 < p < x, 2p appears in the sequence between p and p+1. Therefore we have the identity
n = x + pi(x) - pi(x/2). ... (1)
If a(n) = x = a prime, then (1) is replaced by
n = x + pi(x) - pi(x/2) - 1. ... (2)
If a(n) = x = twice a prime then
n = x/2 + pi(x/2) - pi(x/4). ... (3)
These equations imply that the lower line in the graph of the sequence is
x approx= n(1 - 1/(2*log n)) ... (4)
while the upper line is
x approx= 2n(1 - 1/(2*log n)). ... (5)
a(2*n-1 + A369610(n)) = prime(n). - David James Sycamore, Jan 27 2024

Extensions

Entry revised by N. J. A. Sloane, Nov 03 2020

A337687 a(1) = 2; for n > 1, a(n) = smallest number not occurring earlier which shares a prime factor with a(n-1) and also has a prime factor which is not a factor of a(n-1).

Original entry on oeis.org

2, 6, 10, 12, 14, 18, 15, 20, 22, 24, 21, 28, 26, 30, 33, 36, 34, 38, 40, 35, 42, 39, 45, 48, 44, 46, 50, 52, 54, 51, 57, 60, 55, 65, 70, 58, 56, 62, 66, 63, 69, 72, 68, 74, 76, 78, 75, 80, 82, 84, 77, 88, 86, 90, 85, 95, 100, 92, 94, 96, 87, 93, 99, 102, 98, 91, 104, 106, 108, 105, 110, 112
Offset: 1

Views

Author

Scott R. Shannon, Nov 28 2020

Keywords

Comments

Like A336957 no prime or prime power can be a term as if it shared a prime factor with the previous term it would then not contain a prime factor not in the previous term. It is likely all other composite numbers appear.

Examples

			a(2) = 6 as 2*3 = 6, where 2 is a prime factor shared with a(1) = 2 and 3 is a prime factor which is not a factor of a(1).
a(3) = 10 as 2*5 = 10, where 2 is a prime factor shared with a(2) = 6 and 5 is a prime factor which is not a factor of a(2).
a(4) = 12 as 2*2*3 = 12, where 2 is a prime factor shared with a(3) = 10 and 3 is a prime factor which is not a factor of a(3).
		

Crossrefs

Programs

  • PARI
    isok(k, fprec, v) = {if (#select(x->(x==k), v) == 0, my(f = Set(factor(k)[,1]), finter = setintersect(f, fprec)); #setintersect(f, fprec) && #setminus(f, fprec););}
    lista(nn) = {my(va= vector(nn)); va[1] = 2; for (n=2, nn, my(k=2, fprec = Set(factor(va[n-1])[,1])); while (! isok(k, fprec, va), k++); va[n] = k;); va;} \\ Michel Marcus, Nov 30 2020

A283832 First differences of A280774.

Original entry on oeis.org

1, 2, 3, 4, 3, 10, 4, 3, 4, 4, 10, 6, 8, 3, 4, 17, 4, 4, 9, 17, 7, 4, 4, 4, 5, 4, 13, 4, 20, 12, 14, 44, 3, 4, 13, 11, 4, 10, 11, 8, 11, 4, 16, 4, 4, 9, 8, 4, 20, 15, 6, 7, 16, 4, 6, 4, 8, 21, 14, 4, 26, 4, 15, 6, 4, 6, 12, 28, 23, 20, 10, 10, 52, 12
Offset: 1

Views

Author

N. J. A. Sloane, Mar 22 2017, following a posting to the Sequence Fans Mailing List by Hugo van der Sanden

Keywords

Comments

Let s(m) = A280864(m). The sequence gives the lengths of successive segments when A280864 is split after any term s(m) where every prime divisor of s(m) has already divided s(m-1). (Then s(m+1) is the smallest number not yet in A280864 which is relatively prime to s(m).)
See the link "Properties of A280864" in A280864 for more information.

Crossrefs

A305369 Lexicographically earliest sequence of distinct positive integers such that for each 1 in the binary expansion of a(n), exactly one of a(n-1) and a(n+1) has a 1 in the same position.

Original entry on oeis.org

1, 3, 2, 4, 5, 9, 8, 6, 7, 17, 16, 10, 11, 21, 20, 32, 33, 13, 12, 18, 19, 37, 36, 24, 25, 35, 34, 28, 29, 65, 64, 14, 15, 49, 48, 66, 67, 41, 40, 22, 23, 73, 72, 38, 39, 81, 80, 42, 43, 69, 68, 26, 27, 97, 96, 30, 31, 129, 128, 44, 45, 83, 82, 132, 133, 51, 50, 76, 77, 131, 130, 52, 53, 75, 74, 144, 145, 47, 46, 192
Offset: 1

Views

Author

N. J. A. Sloane, Jun 02 2018

Keywords

Comments

This is to A280864 as A115510 is to A064413 (EKG) and A252867 is to A098550 (Yellowstone).

Examples

			After a(1) = 1, a(2) is the smallest missing odd number, so a(2) = 3.
a(3) is then the smallest missing number of the form ...1*_2, so a(3) = 10_2 = 2.
After a(15) = 20 = 10100_2, a(16) is the smallest missing number of the form ...0*0**_2, which is 100000_2 = 32.
		

References

  • Empirical: a(4k) = 2*Q(2k), a(4k+1) = a(4k)+1, a(4k+2) = 2*Q(2k+1)+1, a(4k+3) = 2*Q(2k+1), where Q (for Quet) is A109812. Since Q has a simpler definition, there is hope for a proof of this connection.

Crossrefs

Cf. A280864, A252867, A098550, A115510, A064413, A109812, A352578 (binary weight).
The graphs of A109812, A252867, A305369, A305372 all have roughly the same, mysterious, fractal-like structure. - N. J. A. Sloane, Jun 03 2018

A372058 Record high-points in A280741.

Original entry on oeis.org

1, 2, 4, 7, 11, 14, 23, 24, 28, 31, 35, 39, 49, 55, 63, 66, 70, 87, 91, 95, 104, 121, 128, 132, 136, 140, 145, 149, 162, 166, 186, 198, 212, 256, 259, 262, 263, 276, 287, 291, 301, 312, 320, 331, 335, 351, 355, 359, 368, 376, 380, 400, 415, 421, 428, 444, 448, 454, 458
Offset: 1

Views

Author

N. J. A. Sloane, Apr 30 2024

Keywords

Crossrefs

A372059 Indices of record high-points in A280741.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337
Offset: 1

Views

Author

N. J. A. Sloane, Apr 30 2024

Keywords

Comments

These are the numbers that take the longest to appear in A280864.
It appears to consist of 1, 25, and the primes.

Crossrefs

A373797 a(n) = maximal k such that there exists a sequence S = [s_1, s_2, ..., s_k] with s_i distinct and in the range 1 <= s_i <= n such that if any s_i is divisible by a prime p, then p also divides exactly one of s_{i-1} and s_{i+1}.

Original entry on oeis.org

1, 1, 1, 3, 3, 4, 4, 6, 6, 8, 8, 10, 10, 11, 11, 13, 13, 14, 14, 16, 16, 17, 17, 19, 19, 21, 22, 24, 24, 25, 25
Offset: 1

Views

Author

N. J. A. Sloane, Jul 26 2024

Keywords

Comments

This is a finite version of the "cup of coffee" sequence A280864.
An obvious upper bound is a(n) <= n-C, where C is the number of primes p <= n such that 2*p > n. For example a(4) <= 3, since we cannot make use of the prime 3.
Note that for a prime p <= n/2, the number of terms in S that are divisible by p must be even. So if floor(n/p) is odd for any p <= n/2, we have a(n) <= n-C-1.
When going from n=p-1 to n=p (where p is a prime), the new p cannot be used, so a(p) = a(p-1) for p prime.
We can obtain a sequence of lower bounds by taking S to consist of the first A280774(m) terms of A280864, for m = 1,2,3,... This gives
a(m) >= max_{1 <= i <= A280774(m)} A280864(i).... (**)
For example, with m=4, we can take the first A280774(4) = 10 terms of A280864, that is, the sequence S = 1,2,4,3,6,8,5,10,12,9, to get a(12) >= 10. In fact equality holds: a(12) = 10 (see EXAMPLES below).
It was possible that equality would always hold in (**). (**) gives a(4) >= 3, a(8) >= 6, a(12) >= 10, a(16) >= 13 (equality holds up to this point), then a(28) >= 23, a(45) >= 27, ... However, Rémy Sigrist has shown that a(28) = 24.
a(24) = 19 so a(25) >= 19. Here is an argument that shows that a(25) = 20 is impossible. We can't use the big primes 13 17 19 23. There are 5 multiples of 5 we could use, 5 10 15 20 25, but we can only use 4 of them. There are 3 multiples of 7 we could use, namely 7 14 21, but we can only use 2 of them. These two lists are disjoint. So a(25) >= 25 - 4 - 2 = 19. - N. J. A. Sloane, Jul 27 2024

Examples

			Solutions for small n (the solutions are a long way from being unique, but see A375030):
  n   a(n)    Solution S
  1    1        1
  4    3        1,2,4
  6    4        1,2,6,3
  8    6        1,2,4,3,6,8
  10   8        1,2,4,3,9,5,10,8
  12   10       1,2,4,3,6,8,5,10,12,9
  14   11       1,2,4,3,6,10,5,7,14,12,9
  16   13       1,2,4,3,6,8,5,10,12,9,7,14,16
As an example, let us verify that the prime-divisibility condition holds for the n=14 solution (we write Y to indicate divisibility):
  S = 1,2,4,3,6,10,5,7,14,12,9
  2?....Y.Y...Y..Y......Y..Y..
  3?........Y.Y............Y.Y
  5?.............Y.Y..........
  7?.................Y..Y.....
The Y's occur in disjoint pairs, as required.
Also, a(18) = 14, from S = 1,8,16,3,6,14,7,5,15,18,4,9,12,2. (We cannot use 11, 13, and 17, and there are an odd number of multiples of 2 and of 5, so we must lose at least one more term - we can take care of this by sacrificing 10 - so 18-4 = 14 is optimal. This implies a(19) = 14 also.)
		

Crossrefs

See A373800 for the right-hand side of (**).

Programs

  • Python
    from itertools import permutations
    from sympy import primefactors, primepi
    def A373797(n):
        c = [set()]+[set(primefactors(i)) for i in range(1,n+1)]+[set()]
        for k in range(n-primepi(n)+primepi(n>>1),0,-1):
            for a in permutations(range(1,n+1),k):
                alist = [0]+list(a)+[n+1]
                if all((p in c[alist[i-1]])^(p in c[alist[i+1]]) for i, d in enumerate(alist[1:-1],1) for p in c[d]):
                    return k # Chai Wah Wu, Jul 26 2024
    
  • Python
    # Given a list S = [s_1, s_2, ..., s_k], this function checks if the terms s_i are such that if any s_i is divisible by a prime p, then p also divides exactly one of s_{i-1} and s_{i+1}.
    from sympy import primefactors
    def isSolution(S: list[int]) -> bool:
        return all(not any((S[i-1] % p == 0) == (S[i+1] % p == 0)
               for p in primefactors(S[i])) for i in range(1, len(S)-1))
    # Peter Luschny, Jul 27 2024
    (C++) // See Links section.

Extensions

a(20)-a(24) from Rémy Sigrist, Jul 27 2024
a(25) from N. J. A. Sloane, Jul 27 2024
a(26)-a(31) from Rémy Sigrist, Jul 28 2024

A338444 Lexicographically earliest sequence of distinct squarefree numbers such that for any prime p, any run of consecutive multiples of p has length exactly 2.

Original entry on oeis.org

1, 2, 6, 3, 5, 10, 14, 7, 11, 22, 26, 13, 15, 30, 34, 17, 19, 38, 42, 21, 23, 46, 58, 29, 31, 62, 66, 33, 35, 70, 74, 37, 39, 78, 82, 41, 43, 86, 94, 47, 51, 102, 106, 53, 55, 110, 114, 57, 59, 118, 122, 61, 65, 130, 134, 67, 69, 138, 142, 71, 73, 146, 154, 77
Offset: 1

Views

Author

Rémy Sigrist, Oct 28 2020

Keywords

Comments

This sequence is a squarefree variant of A280864.
Conjecture: this sequence is a permutation of the squarefree numbers (A005117).

Examples

			The first terms, alongside their prime factors, are:
  n   a(n)  Prime factors
  --  ----  -------------
   1     1
   2     2  2
   3     6  2 3
   4     3    3
   5     5      5
   6    10  2   5
   7    14  2     7
   8     7        7
   9    11          11
  10    22  2       11
  11    26  2         13
  12    13            13
  13    15    3 5
  14    30  2 3 5
  15    34  2           17
  16    17              17
		

Crossrefs

Programs

  • C
    // See Links section.
Previous Showing 31-40 of 54 results. Next