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.

User: \n" if ((30*$

\n" if ((30*$'s wiki page.

\n" if ((30*$ has authored 4192 sequences. Here are the ten most recent ones:

A387522 Index of first term in A386482 that is divisible by the n-th prime.

Original entry on oeis.org

2, 4, 8, 10, 23, 21, 28, 30, 37, 47, 56, 67, 63, 61, 75, 94, 88, 86, 80, 119, 117, 135, 131, 174, 166, 162, 160, 156, 154, 150, 200, 235, 229, 227, 217, 215, 209, 270, 266, 260, 254, 252, 242, 240, 297, 295, 314, 354, 350, 348, 344, 338, 336, 326, 428, 422, 416, 414, 408, 404, 402, 392, 378, 374, 372, 478, 464, 458, 608, 606, 602
Offset: 1

Author

N. J. A. Sloane, Sep 01 2025.

Keywords

Crossrefs

Programs

  • Mathematica
    Block[{p, s}, p[A386482/b386482.txt%22,%20%22Data%22%5D%5B%5BAll,%20-1%5D%5D;%20Do%5BMap%5BIf%5Bp%5B%23%5D%20==%200,%20Set%5Bp%5B%23%5D,%20n%5D%5D%20&,%20FactorInteger%5Bs%5B%5Bn%5D%5D%5D%5B%5B;;%20,%201%5D%5D%5D,%20%7Bn,%20Length%5Bs%5D%7D%5D;%20TakeWhile%5BArray%5Bp%5BPrime%5B%23%5D%5D%20&,%20120%5D,%20%23%20%3E%200%20&%5D%20%5D%20(*%20_Michael%20De%20Vlieger">] := 0; s = Import["https://oeis.org/A386482/b386482.txt", "Data"][[All, -1]]; Do[Map[If[p[#] == 0, Set[p[#], n]] &, FactorInteger[s[[n]]][[;; , 1]]], {n, Length[s]}]; TakeWhile[Array[p[Prime[#]] &, 120], # > 0 &] ] (* _Michael De Vlieger, Sep 03 2025 *)

A386482 a(1)=1, a(2)=2; thereafter a(n) is either the greatest number k < a(n-1) not already used such that gcd(k, a(n-1)) > 1, or if no such k exists then a(n) is the smallest number k > a(n-1) not already used such that gcd(k, a(n-1)) > 1.

Original entry on oeis.org

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

Author

N. J. A. Sloane, Aug 15 2025, based on email messages from Geoffrey Caveney

Keywords

Comments

Similar to the EKG sequence A064413, but whereas in that sequence a(n) is chosen to be as small as possible, here the primary goal is to choose a(n) to be less than a(n-1) and as close to it as possible. This sequence first differs from the EKG sequence at n = 8, where a(8) = k = 10 is closer to a(7) = 12 than A064413(8) = 8 is.
A significant difference from the EKG sequence is that the primes do not appear in their natural order. Also, it is not always true that a prime p is preceded by 2*p when it first appears. 4k+3 primes appear to be preceded by smaller multiples than 4k+1 primes.
It is conjectured that every positive number appears.
It is interesting to study what happens if the first two terms are taken to be 1,s, with s >= 2, or if the first s terms are taken to be 1,2,3,...,s, with s >= 2. Call two such sequences equivalent if they eventually merge. The 1,3 and 1,2,3 sequences merge with each other after half-a-dozen terms. But at present we do not know if they merge with the 1,2 sequence.
It appears that many sequences that start 1,s and 1,2,3,...,s with small s merge with one of the sequences 1,2 or 1,2,3 or 1,2,3,...,11.
[The preceding comments are from Geoffrey Caveney's emails.]
From Michael De Vlieger, Aug 15 2025: (Start)
There are long runs of terms with the same parity in this sequence. For example, beginning at a(481) = 948, there are 100 consecutive even terms. Starting with a(730076) = 1026330, there are 100869 consecutive even terms, followed by 36709 consecutive odd terms. Runs of even terms tend to be longer than those of odd.
There are long runs of first differences of -2 and -6 in this sequence, and that there appear to be three phases. The predominant (A) phase has a(n) = a(n-1)-2, the second (B) phase has a(n) = a(n-1)-6, and then there is a turbulent (C) phase [C] with varied differences.
Generally the even runs correspond to differences a(n)-a(n-1) = 2 and feature square-free terms separated by an odd number of terms in A126706. Phase [C] tends to be largely odd squarefree semiprimes and includes prime powers. (End)

References

  • Geoffrey Caveney, Emails to N. J. A. Sloane, Aug 13 2025 - Aug 15 2025.

Crossrefs

Cf. A064413 (EKG), A387072 (inverse), A387073 (record high points), A387074 (indices of record high points), A387075 (first differences), A387076 (primes in order of appearance), A387077 (indices of primes), A387078 (run lengths of consecutive odd and even terms), A387080 (variant that begins with 1,3).

Programs

  • Mathematica
    aList[n_] := Module[{an = 2, aset = <|2 -> True|>, m}, Reap[Sow[1]; Sow[an];
    Do[m = SelectFirst[Range[an - 1, 2, -1], ! KeyExistsQ[aset, #] && GCD[#, an] > 1 & ];
    If[MissingQ[m], m = NestWhile[# + 1 &, an + 1, !(! KeyExistsQ[aset, #] && GCD[#, an] > 1) & ]];
    aset[m] = True; an = m; Sow[an], {n - 2}]][[2, 1]]]; aList[83]  (* Peter Luschny, Aug 15 2025 *)
  • PARI
    \\ See Links section.
    
  • Python
    from math import gcd
    from itertools import count, islice
    def A386482_gen(): # generator of terms
        yield 1
        an, aset = 2, {2}
        while True:
            yield an
            m = next((k for k in range(an-1, 1, -1) if k not in aset and gcd(k, an) > 1), False)
            if not m: m = next(k for k in count(an+1) if k not in aset and gcd(k, an) > 1)
            an = m
            aset.add(an)
    print(list(islice(A386482_gen(), 83))) # Michael S. Branicky, Aug 15 2025

A386478 Array read by upward antidiagonals: T(k,n) = 1 (k = 0, n >= 0), T(k,n) = k^2*n^2/2 - (3*k-4)*n/2 + 1 (k >= 1, n >= 0).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 4, 1, 1, 3, 7, 7, 1, 1, 5, 14, 16, 11, 1, 1, 8, 25, 34, 29, 16, 1, 1, 12, 40, 61, 63, 46, 22, 1, 1, 17, 59, 97, 113, 101, 67, 29, 1, 1, 23, 82, 142, 179, 181, 148, 92, 37, 1, 1, 30, 109, 196, 261, 286, 265, 204, 121, 46, 1, 1, 38, 140, 259, 359, 416, 418, 365, 269, 154, 56, 1, 1, 47, 175, 331, 473, 571, 607, 575, 481, 343, 191, 67, 1
Offset: 0

Author

N. J. A. Sloane, Jul 24 2025

Keywords

Comments

A k-chain is a planar graph consisting of a continuous path made up of k straight segments. T(k,n) is the maximum number of regions the plane can be divided into by drawing n k-chains.
The array is almost symmetric: the difference between T(k,n) and T(n,k) is 2*|k-n| (which is exactly the difference between the numbers of infinite regions). All the rows and columns satisfy the recurrence u(n) = 3*u(n-1) - 3*u(n-2) + u(n-3).

Examples

			Array begins (the rows are T(0,n>=0),, T(1,n>=0), T(2,n>=0), ...):
  1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ...
  1, 2, 4, 7, 11, 16, 22, 29, 37, ...
  1, 2, 7, 16, 29, 46, 67, 92, 121, ...
  1, 3, 14, 34, 63, 101, 148, 204, 269, ...
  1, 5, 25, 61, 113, 181, 265, 365, 481, ...
  1, 8, 40, 97, 179, 286, 418, 575, 757, ...
  1, 12, 59, 142, 261, 416, 607, 834, 1097, ...
  1, 17, 82, 196, 359, 571, 832, 1142, 1501, ...
  1, 23, 109, 259, 473, 751, 1093, 1499, 1969, ...
  ...
The first few antidiagonals are:
  1,
  1, 1,
  1, 2, 1,
  1, 2, 4, 1,
  1, 3, 7, 7, 1,
  1, 5, 14, 16, 11, 1,
  1, 8, 25, 34, 29, 16, 1,
  1, 12, 40, 61, 63, 46, 22, 1,
  ...
		

References

  • David O. H. Cutler and N. J. A. Sloane, paper in preparation, August 1 2025.

Crossrefs

The first few rows are A000124, A130883, A140064, A080856, A383465.
The n=1 and 2 columns are A152948 and A386479.

Programs

  • Mathematica
    A386478[k_, n_] := If[k == 0, 1, ((k*n - 3)*k + 4)*n/2 + 1];
    Table[A386478[k - n, n], {k, 0, 12}, {n, 0, k}] (* Paolo Xausa, Jul 26 2025 *)

Extensions

Row 0 added by N. J. A. Sloane, Jul 26 2025

A383460 13 X oo array read by antidiagonals, giving the values of the standard mod 13 Ackermann function.

Original entry on oeis.org

1, 2, 2, 3, 3, 3, 5, 5, 4, 4, 0, 0, 7, 5, 5, 5, 5, 3, 9, 6, 6, 9, 9, 6, 9, 11, 7, 7, 9, 9, 5, 2, 8, 0, 8, 8, 9, 9, 9, 9, 3, 6, 2, 9, 9, 9, 9, 9, 9, 5, 9, 2, 4, 10, 10, 9, 9, 9, 9, 9, 9, 11, 7, 6, 11, 11, 9, 9, 9, 9, 9, 9, 5, 1, 4, 8, 12, 12
Offset: 0

Author

N. J. A. Sloane, May 30 2025

Keywords

Comments

The sixth and later columns consist of all 9's, and so the antidiagonals beyond that point also consist of all 9's.

Examples

			The first few antidiagonals are:
  1,
  2, 2,
  3, 3, 3,
  5, 5, 4, 4,
  0, 0, 7, 5, 5,
  5, 5, 3, 9, 6, 6,
  9, 9, 6, 9, 11, 7, 7,
  9, 9, 5, 2, 8, 0, 8, 8,
  9, 9, 9, 9, 3, 6, 2, 9, 9,
  ...
		

Crossrefs

Cf. A085119.

Programs

  • Mathematica
    n=12;a[i_,j_]:=a[i,j]=If[i==0,Mod[j+1,13],If[j==0,a[i-1,1],a[i-1,a[i,j-1]]]]; Flatten@Table[Diagonal[Reverse@Table[a[i,j],{i,0,n},{j,0,n}],k-n-1],{k,n}] (* Giorgos Kalogeropoulos, May 31 2025 *)

Extensions

More terms from Giorgos Kalogeropoulos, May 31 2025

A383442 a(0) = 0; thereafter a(n) is the least integer (in absolute value) not yet in the sequence such that the absolute difference between a(n-1) and a(n) is a triangular number; in case of a tie, preference is given to the positive value.

Original entry on oeis.org

0, 1, 2, -1, -2, -3, 3, 4, 5, -5, -4, 6, 7, 8, -7, -6, 9, 10, 11, -10, -9, -8, -11, -12, -13, -14, 14, 13, 12, 15, 16, 17, 18, -18, -15, -16, -17, 19, 20, 21, 22, 23, -22, -19, -20, -21, 24, 25, 26, 27, 28, -27, -24, -23, -26, -25, -28, -29, -30, -31, -32, -33, 33, 30, 29, 32, 31, 34, 35, 36, 37, 38, 39, -39, -36, -35, -34, -37, -38, 40
Offset: 0

Author

N. J. A. Sloane, May 03 2025

Keywords

Comments

Heraclitus (circa 500 BCE) observed that no man can step in the same river twice.
The Heraclitus transform H(S) of a sequence S is formed by starting at 0, and moving s steps to the left or right, where s is any element of S, never visiting any number twice, and moving as close to 0 as possible. In case of a tie, move to the positive term.
The present sequence is the Heraclitus transform of the triangular numbers A000217. For the squares, see A377091. Conjecture: both H(A000217) and H(A000290) contain every (positive or negative) integer. In fact it appears that this property holds whenever S is a monotonically strictly increasing sequence starting with 1. It does not hold for H(A000012), which is A001477.

Programs

  • Mathematica
    A383442list[nmax_] := Module[{s, a, u = 1}, s[_] := False; s[0] = True; NestList[(While[s[u] && s[-u], u++]; a = u; While[s[a] || !IntegerQ[Sqrt[8*Abs[# - a]+1]], a = Boole[a < 0] - a]; s[a] = True; a) &, 0, nmax]];
    A383442list[100] (* Paolo Xausa, May 05 2025 *)
  • Python
    from math import isqrt
    from itertools import count, islice
    def cond(n): return isqrt(m:=8*n+1)**2 == m
    def agen(): # generator of terms
        an, aset, m = 0, {0}, 1
        for n in count(0):
            yield an
            an = next(s for k in count(m) for s in [k, -k] if s not in aset and cond(abs(an-s)))
            aset.add(an)
            while m in aset and -m in aset: m += 1
    print(list(islice(agen(), 80))) # Michael S. Branicky, May 03 2025

A383447 Number of "peerless" trees on n nodes.

Original entry on oeis.org

1, 0, 1, 1, 2, 3, 6, 9, 19, 33, 67, 130, 270, 547, 1165, 2456, 5314, 11521, 25357, 56022, 125067, 280471, 633490, 1437340, 3278912, 7510503, 17277697, 39890262, 92427559, 214835923, 500879602, 1171013350, 2744946654, 6450077870
Offset: 1

Author

N. J. A. Sloane, May 01 2025, based on postings to the SeqFan Mailing List in April and May 2025 by Victor S. Miller, Allan C. Wechsler, Brendan McKay, and others

Keywords

Comments

A "peerless" tree is an unlabeled, unrooted tree (as in A000055) with the property that if two nodes are joined by an edge then these nodes have different degrees.
Victor S. Miller reports that this sequence was first proposed on Project Euler.
Comment from Brendan McKay, May 01 2025 (Start)
The enumeration could be extended by the following argument.
If the tree has a unique centroid (not center!) then removing the centroid gives rooted subtrees of size less than n/2. If there are two centroids, they are adjacent and removing that edge gives two rooted subtrees with exactly n/2 vertices.
Start by making all rooted trees up to n/2 vertices which have no adjacent vertices of the same degree, not counting adjacencies of the root. Then classify them according to which degrees the root can be increased to without violating this condition for edges adjacent to the root.
With this information the counts for n vertices can be reconstructed. In this way getting up past 60 vertices should be possible. (End)
This sequence forms the left-most column of A383448.

Crossrefs

Extensions

a(1)-a(8) were computed by Allan C. Wechsler, Apr 30 2025, and a(9)-a(34) by Brendan McKay, May 02 2025.

A383446 Index of -n in A377090, or -1 if -n does not appear there.

Original entry on oeis.org

0, 2, 4, 8, 6, 11, 7, 12, 18, 13, 19, 25, 20, 26, 32, 27, 33, 38, 34, 39, 44, 40, 45, 51, 46, 52, 50, 53, 59, 57, 60, 58, 65, 69, 64, 70, 74, 72, 78, 73, 77, 83, 86, 84, 87, 85, 95, 97, 94, 96, 101, 104, 102, 107, 103, 108, 114, 109, 115, 118, 116, 119, 117, 120, 129, 132, 130, 136, 131, 135, 140, 143, 141, 144, 142, 145, 156
Offset: 0

Author

N. J. A. Sloane, Apr 30 2025

Keywords

Comments

It is conjectured (see A377090) that every positive integer appears exactly once either here or in A383445.

Crossrefs

A383445 Index of n in A377090, or -1 if n does not appear there.

Original entry on oeis.org

0, 3, 1, 5, 9, 15, 10, 16, 14, 17, 23, 21, 24, 22, 28, 31, 29, 36, 30, 35, 37, 43, 41, 47, 42, 48, 54, 49, 55, 61, 56, 62, 67, 63, 68, 66, 71, 75, 80, 76, 81, 79, 82, 89, 91, 88, 90, 92, 99, 93, 98, 100, 105, 111, 106, 112, 110, 113, 124, 122, 125, 123, 126, 128, 121, 127, 133, 138, 134, 139, 137, 147, 150, 148, 146, 149, 153
Offset: 0

Author

N. J. A. Sloane, Apr 30 2025

Keywords

Comments

It is conjectured (see A377090) that every positive integer appears exactly once either here or in A383446.

Crossrefs

A382715 The term in A377091 that immediately precedes n, or 0 if n does not appear in A377091.

Original entry on oeis.org

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

Author

N. J. A. Sloane, Apr 09 2025

Keywords

Comments

It is a strong conjecture that every integer appears in A377091, so it is unlikely there will be a second 0 term.

Examples

			A377091(9) = -3 is followed by A377091(10) = 6, so a(6) = -3.
		

A382155 a(n) = (n+1)! if n <= 2; thereafter a(n) = 4*n if n even or 2*n if n odd.

Original entry on oeis.org

1, 2, 6, 6, 16, 10, 24, 14, 32, 18, 40, 22, 48, 26, 56, 30, 64, 34, 72, 38, 80, 42, 88, 46, 96, 50, 104, 54, 112, 58, 120, 62, 128, 66, 136, 70, 144, 74, 152, 78, 160, 82, 168, 86, 176, 90, 184, 94, 192, 98, 200, 102, 208, 106, 216, 110, 224, 114, 232, 118, 240, 122, 248, 126, 256, 130, 264, 134, 272, 138, 280, 142, 288, 146, 296
Offset: 0

Author

N. J. A. Sloane, Mar 23 2025

Keywords

Comments

Let G denote the 2-dimensional grid obtained from the square grid Z X Z by deleting the vertices with both coordinates odd and the four edges at each of those vertices (see link). G has vertices with valency either 2 (one coordinate even and one odd, indicated by X) or 4 (both coordinates even, indicated by O). The present sequence is the coordination sequence of G with respect to a vertex of valency 2.
See A382154 for further information.

Crossrefs

Partial sums give A382156.

Programs

  • Mathematica
    Join[{1, 2, 6}, Riffle[4*# + 2, 8*(# + 1)]] & [Range[50]] (* Paolo Xausa, Mar 24 2025 *)
  • Python
    def A382155(n): return (1,2,6)[n] if n<3 else n<<(2>>(n&1)) # Chai Wah Wu, Mar 24 2025

Formula

G.f.: (-2*x^6+5*x^4+2*x^3+4*x^2+2*x+1)/(1-x^2)^2.