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: }] = f[{

}] = f[{'s wiki page.

}] = f[{ has authored 3263 sequences. Here are the ten most recent ones:

A386593 Number of sub-relation-algebras of Re(n), the collection of all binary relations over {1,2,...,n}.

Original entry on oeis.org

1, 2, 6, 30, 124
Offset: 1

Author

Jeremy F. Alm, Jul 26 2025

Keywords

Comments

The first four terms are not that difficult to verify. In fact, for n < 5 the subalgebra lattice of Re(n) is the dual of the subgroup lattice of S_n. Hence a(n) = A005432(n) for n < 5.
Relation algebras are closed under union, intersection, complement, composition, inverse, and identity.

References

  • Bjarni Jónsson, Maximal algebras of binary relations. In: Contributions to Group Theory, Contemporary Mathematics, vol. 33, pp. 299-307. Amer. Math. Soc., Providence (1984).

Crossrefs

Cf. A005432.

A385023 Number of cuboids (rectangular prisms) that can be formed from the points of Z^3 (a cubical grid of n X n X n points).

Original entry on oeis.org

0, 1, 36, 372, 2032, 8107, 24986, 66688, 155896, 332657, 653708, 1216076, 2135220, 3604679, 5845214, 9160864, 13947880, 20778029, 30205036, 43114824, 60340252, 83145027, 112870514, 151270988, 199965096, 261491409
Offset: 1

Author

Keith F. Lynch, Jun 15 2025

Keywords

Comments

Skew cuboids are allowed. The number of orthogonal cuboids is simply binomial(n, 2)^3.
The first 15 terms were independently computed by Keith Lynch and Michael Beeler. Terms 16 through 26 are from Michael Beeler.

Examples

			The only solution for n=2 is:
  0,0,0; 0,0,1; 0,1,0; 0,1,1; 1,0,0; 1,0,1; 1,1,0; 1,1,1
The 36 solutions for n=3 are:
  0,0,0; 0,0,1; 0,1,0; 0,1,1; 2,0,0; 2,0,1; 2,1,0; 2,1,1
  0,0,0; 0,0,1; 0,2,0; 0,2,1; 1,0,0; 1,0,1; 1,2,0; 1,2,1
  0,0,0; 0,0,1; 0,2,0; 0,2,1; 2,0,0; 2,0,1; 2,2,0; 2,2,1
  0,0,0; 0,0,2; 0,1,0; 0,1,2; 1,0,0; 1,0,2; 1,1,0; 1,1,2
  0,0,0; 0,0,2; 0,1,0; 0,1,2; 2,0,0; 2,0,2; 2,1,0; 2,1,2
  0,0,0; 0,0,2; 0,2,0; 0,2,2; 1,0,0; 1,0,2; 1,2,0; 1,2,2
  0,0,1; 0,0,2; 0,1,1; 0,1,2; 2,0,1; 2,0,2; 2,1,1; 2,1,2
  0,0,1; 0,0,2; 0,2,1; 0,2,2; 1,0,1; 1,0,2; 1,2,1; 1,2,2
  0,0,1; 0,0,2; 0,2,1; 0,2,2; 2,0,1; 2,0,2; 2,2,1; 2,2,2
  0,0,1; 0,1,0; 0,1,2; 0,2,1; 1,0,1; 1,1,0; 1,1,2; 1,2,1
  0,0,1; 0,1,0; 0,1,2; 0,2,1; 2,0,1; 2,1,0; 2,1,2; 2,2,1
  0,0,1; 0,1,1; 1,0,0; 1,0,2; 1,1,0; 1,1,2; 2,0,1; 2,1,1
  0,0,1; 0,2,1; 1,0,0; 1,0,2; 1,2,0; 1,2,2; 2,0,1; 2,2,1
  0,1,0; 0,1,1; 0,2,0; 0,2,1; 2,1,0; 2,1,1; 2,2,0; 2,2,1
  0,1,0; 0,1,1; 1,0,0; 1,0,1; 1,2,0; 1,2,1; 2,1,0; 2,1,1
  0,1,0; 0,1,2; 0,2,0; 0,2,2; 1,1,0; 1,1,2; 1,2,0; 1,2,2
  0,1,0; 0,1,2; 0,2,0; 0,2,2; 2,1,0; 2,1,2; 2,2,0; 2,2,2
  0,1,0; 0,1,2; 1,0,0; 1,0,2; 1,2,0; 1,2,2; 2,1,0; 2,1,2
  0,1,1; 0,1,2; 0,2,1; 0,2,2; 2,1,1; 2,1,2; 2,2,1; 2,2,2
  0,1,1; 0,1,2; 1,0,1; 1,0,2; 1,2,1; 1,2,2; 2,1,1; 2,1,2
  0,1,1; 0,2,1; 1,1,0; 1,1,2; 1,2,0; 1,2,2; 2,1,1; 2,2,1
  1,0,0; 1,0,1; 1,2,0; 1,2,1; 2,0,0; 2,0,1; 2,2,0; 2,2,1
  0,1,1; 0,2,1; 1,1,0; 1,1,2; 1,2,0; 1,2,2; 2,1,1; 2,2,1
  1,0,0; 1,0,1; 1,2,0; 1,2,1; 2,0,0; 2,0,1; 2,2,0; 2,2,1
  1,0,0; 1,0,2; 1,1,0; 1,1,2; 2,0,0; 2,0,2; 2,1,0; 2,1,2
  1,0,0; 1,0,2; 1,2,0; 1,2,2; 2,0,0; 2,0,2; 2,2,0; 2,2,2
  1,0,1; 1,0,2; 1,2,1; 1,2,2; 2,0,1; 2,0,2; 2,2,1; 2,2,2
  1,0,1; 1,1,0; 1,1,2; 1,2,1; 2,0,1; 2,1,0; 2,1,2; 2,2,1
  1,1,0; 1,1,2; 1,2,0; 1,2,2; 2,1,0; 2,1,2; 2,2,0; 2,2,2
  0,0,0; 0,0,1; 0,1,0; 0,1,1; 1,0,0; 1,0,1; 1,1,0; 1,1,1
  0,0,1; 0,0,2; 0,1,1; 0,1,2; 1,0,1; 1,0,2; 1,1,1; 1,1,2
  0,1,0; 0,1,1; 0,2,0; 0,2,1; 1,1,0; 1,1,1; 1,2,0; 1,2,1
  0,1,1; 0,1,2; 0,2,1; 0,2,2; 1,1,1; 1,1,2; 1,2,1; 1,2,2
  1,0,0; 1,0,1; 1,1,0; 1,1,1; 2,0,0; 2,0,1; 2,1,0; 2,1,1
  1,0,1; 1,0,2; 1,1,1; 1,1,2; 2,0,1; 2,0,2; 2,1,1; 2,1,2
  1,1,0; 1,1,1; 1,2,0; 1,2,1; 2,1,0; 2,1,1; 2,2,0; 2,2,1
  1,1,1; 1,1,2; 1,2,1; 1,2,2; 2,1,1; 2,1,2; 2,2,1; 2,2,2
		

Crossrefs

Cf. A098928.

A384102 Least x in absolute value, such that there exists y, |x| >= |y| > 0, such that n = |6xy + x + y|, or 0 if no such x exists. Choose x > 0 if x and -x are both possible.

Original entry on oeis.org

0, 0, 0, -1, 0, 1, 0, 1, -2, 0, 2, 0, -2, -3, 2, 3, 0, 0, -4, -2, 4, 3, 0, 2, 0, 5, -4, 2, 4, 0, -3, 0, 0, -5, 3, 5, -3, 0, -8, 0, 3, -4, 6, -9, 0, 4, 0, -3, -10, -4, 10, 0, -5, 3, -8, 11, 5, 0, -12, 3, 12, -9, -5, -6, -4, 13, 5, 6, -10, 0, 4, 0, -4, -15, -7, -6, 0, 11, 4, 6, 16, -5, -12, -17, 12, -8, 0, -4, -7, 8, 18, -5, 7, -19, 0, 4, -9, 5, -6
Offset: 1

Author

M. F. Hasler, Jun 20 2025

Keywords

Comments

(6n-1, 6n+1) are twin primes iff a(n) = 0, that is, if there are no nonzero integers x, y such that n = |6xy + x + y|. (These n are listed in A002822, the complement is A067611.)
a(n) <= (6*n-1)/5, with equality if 6*n+1 is prime and 6*n-1 is 5 times a prime. - Robert Israel, Jul 21 2025

Examples

			For n = 1, 2 and 3, there are no nonzero x,y such that n = |6xy + x + y|, and (6n-1, 6n+1) = (5, 7), (11, 13) and (17, 19) are indeed twin primes.
For n = 4 we have x = y = -1 such that |6xy + x + y| = |6 - 1 - 1| = 4 and (23, 25) is indeed not a twin prime pair.
		

Crossrefs

Cf. A384103 (the corresponding y-values).
Cf. A002822 (indices of zeros: n such that 6n-1 and 6n+1 are twin primes).
Cf. A077800 (list of twin primes), A060461, A171696 (none among 6n+-1 is prime), A067611 (n = 6xy +- x +- y: 6n-1 or 6n+1 is composite).

Programs

  • Maple
    f:= proc(n) local V, C, t, m,v, r;
           V:= numtheory:-divisors(6*n+1) minus {1,6*n+1};
           C:= map(u -> `if`(u mod 6 = 1,  [(u-1)/6, ((6*n+1)/u - 1)/6], [(-u-1)/6, (-(6*n+1)/u - 1)/6]), V);
           V:= numtheory:-divisors(6*n-1) minus {1,6*n-1};
           C:= C union map(u -> `if`(u mod 6 = 1, [(u-1)/6, ((-6*n+1)/u - 1)/6], [(-u-1)/6, ((-6*n+1)/u - 1)/6]), V);
           C:= select(t -> abs(t[1]) >= abs(t[2]), C)[..,1];
           if C = {} then return 0 fi;
           m:= infinity;
           for t in C do
             if abs(t) < m then m:= abs(t); r:= t;
             elif abs(t) = m and t > 0 then r:= t
             fi
           od;
           r
     end proc:
    map(f, [$1..100]); # Robert Israel, Jul 21 2025
  • PARI
    {A384102(n)=for(x=1,n\/5, my(p=6*x+1, q=6*x-1, r=if((n-x)%p==0, (n-x)\p, (n+x)%p==0, (n+x)\p, (n-x)%q==0, (x-n)\q, (n+x)%q==0,-(n+x)\q)); r && abs(r) <= x && return(sign(r)*x))}

A384103 a(n) = y with minimum |x| >= |y| > 0, such that n = |6xy + x + y|, or 0 if no such x, y exist. If x and -x are solutions, choose x > 0 > y = -x.

Original entry on oeis.org

0, 0, 0, -1, 0, -1, 0, 1, -1, 0, -1, 0, 1, -1, 1, -1, 0, 0, -1, -2, -1, 1, 0, -2, 0, -1, 1, 2, 1, 0, -2, 0, 0, 1, -2, 1, 2, 0, -1, 0, 2, -2, 1, -1, 0, -2, 0, -3, -1, 2, -1, 0, -2, -3, 1, -1, -2, 0, -1, 3, -1, 1, 2, -2, -3, -1, 2, -2, 1, 0, -3, 0, 3, -1, -2, 2, 0, 1, 3, 2, -1, -3, 1, -1, 1, -2, 0, -4, 2, -2
Offset: 1

Author

M. F. Hasler, Jun 20 2025

Keywords

Comments

(6n-1, 6n+1) are twin primes iff a(n) = 0, that is, if there are no nonzero integers x, y such that n = |6xy + x + y|. These n are listed in A002822, the complement is A067611.
The corresponding x-values are listed in A384102.

Examples

			For n = 1, 2 and 3, there are no nonzero x,y such that n = |6xy + x + y|, and (6n-1, 6n+1) = (5, 7), (11, 13) and (17, 19) are indeed twin primes.
For n = 4 we have x = y = -1 such that |6xy + x + y| = |6 - 1 - 1| = 4 and (23, 25) is indeed not a twin prime pair.
		

Crossrefs

Cf. A384102 (the corresponding x-values).
Cf. A002822 (indices of zeros: n such that 6n-1 and 6n+1 are twin primes).
Cf. A077800 (list of twin primes), A060461, A171696 (none among 6n+-1 is prime), A067611 (n = 6xy +- x +- y: 6n-1 or 6n+1 is composite).

Programs

  • Maple
    f:= proc(n) local V, C, t, m, v, r;
           V:= numtheory:-divisors(6*n+1) minus {1, 6*n+1};
           C:= map(u -> `if`(u mod 6 = 1,  [(u-1)/6, ((6*n+1)/u - 1)/6], [(-u-1)/6, (-(6*n+1)/u - 1)/6]), V);
           V:= numtheory:-divisors(6*n-1) minus {1, 6*n-1};
           C:= C union map(u -> `if`(u mod 6 = 1, [(u-1)/6, ((-6*n+1)/u - 1)/6], [(-u-1)/6, ((6*n-1)/u - 1)/6]), V);
           C:= select(t -> abs(t[1]) >= abs(t[2]), C);
           if C = {} then return 0 fi;
           m:= infinity;
           for t in C do
             if abs(t[1]) < m then m:= abs(t[1]); r:= t[2];
             elif abs(t[1]) = m and t[1] > 0 then r:= t[2]
             fi
           od;
           r
     end proc:
    map(f, [$1..100]); # Robert Israel, Jul 21 2025
  • PARI
    apply( {A384103(n)=for(x=1,n\/5, my(p=6*x+1, q=6*x-1, y=if((n-x)%p==0, (n-x)\p, (n+x)%p==0, -(n+x)\p, (n-x)%q==0, (n-x)\q, (n+x)%q==0,-(n+x)\q)); y && abs(y) <= x && return(y))}, [1..90])

A384095 Numbers other than {10^a + 10^b + 1} and {10^a + 5*10^b, min(a, b) = 0} whose square has digit sum 9 and no trailing zero.

Original entry on oeis.org

9, 18, 39, 45, 48, 249, 318, 321, 348, 351, 549, 1149, 1761, 4899, 10149, 14499, 375501
Offset: 1

Author

M. F. Hasler, Jun 15 2025

Keywords

Comments

The definition excludes the two "regular" subsequences of A384094, namely A052216+1 = 3*A237424 and A133472 U A199685, which provide most of its terms.
Is it true that no number > 1049 = A215614(6) has a square with digit sum less than 9, other than the trivial 1 and 4?
The next term, if it exists, is a(18) > 10^8.
a(18) > 10^14 if it exists. - Robert Israel, Jun 15 2025
a(18) > 10^40 if it exists. - Chai Wah Wu, Jun 19 2025

Crossrefs

Cf. A004159 (sum of digits of n^2), A384094 (sumdigits(n^2) = 9), A133472 (10^n+5), A199685 (5*10^n + 1), A052216 (10^a+10^b), A237424 ((10^a+10^b+1)/3).
See also: A215614 (sumdigits(n^2) = 7), A058414 (digits(n²) ⊂ {0,1,4}).

Programs

  • Maple
    extend:= proc(a,d) local i,s;
        s:= convert(convert(a,base,10),`+`);
        op(select(t -> numtheory:-quadres(t,10^d)=1, [seq(i*10^(d-1)+a, i=0 .. 9 - s)]))
    end proc:
    istriv:= proc(n) local L;
       L:= subs(0=NULL,convert(n,base,10));
       member(L, [[4],[5],[6],[1,1],[1,1,1],[1,2],[2,1],[1,5],[5,1]])
    end proc:
    R:= NULL:
    A:= [1,4,5,6,9]:
    for d from 2 to 20 do
      A:= map(extend,A,d);
      V:= select(t -> t > 10^(d-1) and issqr(t) and convert(convert(t,base,10),`+`)=9, A);
      if V <> [] then V:= sort(remove(istriv,map(sqrt,V))); R:= R,op(V); fi
    od:
    R;# Robert Israel, Jun 15 2025
  • PARI
    select( {is_A384095(n)=n%10 && sumdigits(n^2)==9 && !bittest(36938, fromdigits(Set(digits(n))))}, [1..10^5])

A384704 Triangle T(i, j), 1 <= j <= i, read by rows. T(i, j) is the smallest number k that has i odd divisors and whose symmetric representation of sigma, SRS(k), has j parts; when no such k exists then T(i, j) = -1.

Original entry on oeis.org

1, 6, 3, 18, -1, 9, 30, 78, 15, 21, 162, -1, -1, -1, 81, 90, 666, 45, 75, 63, 147, 1458, -1, -1, -1, -1, -1, 729, 210, 1830, 135, 105, 165, 189, 357, 903, 450, -1, 225, -1, 1225, -1, 441, -1, 3025, 810, 53622, 405, -1, 1377, 1875, 567, 1539, 4779, 6875, 118098, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59049
Offset: 1

Author

Hartmut F. W. Hoft, Jun 07 2025

Keywords

Comments

T(i, j) = -1 for i >= 1 odd, nonprime, j even with 1 < j < i; also for i prime and all j with 1 < j < i.
The single value T(10, 4) = -1 has been verified; see the conjecture below.
T(i, i) <= 3^(i-1) for all i >=1 . Equality holds for all primes i. T(i, i) = A318843(i), for all i >= 1.
A038547(i) is the smallest number with exactly i odd divisors. Thus odd number A038547(i) occurs in row i of triangle T(i, j) so that A038547 is a subsequence of this sequence. For i prime, A038547(i) = T(i, i). For 4 <= i <= 10^9 nonprime, A038547(i) is in the third column, T(i, 3), except for i=8; furthermore, the first part of SRS(A038547(i)) has width 1 and size (A038547(i)+1)/2.
T(i, 1) <= 2 * 3^(i-1) and it is even for all i >1. Equality holds for all primes i.
T(i, 2) <= 2 * 3^(i/2-1) * p for all even i where p is the smallest prime greater than 4 * 3^(i/2-1). Equality holds when i = 2 * h where h is prime.
The positive numbers in columns 1..6 are subsequences of A174973, A239929, A279102, A280107, A320066, A320511, respectively.
Conjectures:
All entries T(i, j) in columns j >= 3 are odd.
T(i, 1)/2 is odd for all i > 1.
T(i, 1) = 2 * T(i, 3) for all nonprime i > 3, for i = 3, but not for i = 8.
T(i, 2)/2 is odd for all even i > 2.
T(i, 3) = A038547(i) for all nonprime i > 3, except i = 8.
T(2*i, 2*j) = -1 for j >= 2 and all prime i satisfying i >= prime(j+1).
From Omar E. Pol, Jun 08 2025: (Start)
T(i,j) is also the smallest number k whose symmetric representation of sigma(k) has i subparts and j parts, or -1 if no such k exists.
Observations:
At least for i < 12 if i is prime then T(i,1) = 2*T(i,i).
At least for i < 12 if i is prime then all terms in row i are -1's except the first and the last term. (End)

Examples

			The first 12 rows of triangle T(i, j):
   i\j      1     2   3   4    5    6    7    8    9   10    11    12
   1:       1
   2:       6     3
   3:      18    -1   9
   4:      30    78  15  21
   5:     162    -1  -1  -1   81
   6:      90   666  45  75   63  147
   7:    1458    -1  -1  -1   -1   -1  729
   8:     210  1830 135 105  165  189  357  903
   9:     450    -1  25  -1 1225   -1  441   -1 3025
  10:     810 53622 405  -1 1377 1875  567 1539 4779 6875
  11:  118098    -1  -1  -1   -1   -1   -1   -1   -1   -1 59049
  12:     630 16290 315 495  525 1071 1287 1197 2499 6069 13915 29095
  ...
		

Programs

  • Mathematica
    (* function partsSRS[ ] is defined in A377654 *)
    setupT[d_] := Module[{list=Table[0, {i, d}, {j, i}], s, t}, For[s=1, s<=d, s++, For[t=1, t<=s, t++, If[(OddQ[s]&&Not[PrimeQ[s]]&&EvenQ[t]&&1
    				

A384094 Numbers whose square has digit sum 9 and no trailing zero.

Original entry on oeis.org

3, 6, 9, 12, 15, 18, 21, 39, 45, 48, 51, 102, 105, 111, 201, 249, 318, 321, 348, 351, 501, 549, 1002, 1005, 1011, 1101, 1149, 1761, 2001, 4899, 5001, 10002, 10005, 10011, 10101, 10149, 11001, 14499, 20001, 50001, 100002, 100005, 100011, 100101, 101001, 110001, 200001, 375501, 500001, 1000002
Offset: 1

Author

M. F. Hasler, Jun 15 2025

Keywords

Comments

All numbers of the form 10^a + 10^b + 1 (i.e., A052216+1 = 3*A237424) and of the form 10^a + 5*10^b with min(a, b) = 0 (i.e., A133472 U A199685), are in this sequence. Terms not of this form are (9, 18, 39, 45, 48, 249, 318, 321, 348, 351, 549, 1149, 1761, 4899, 10149, 14499, 375501, ...), see subsequence A384095. (Is this sequence finite? What is the next term?)
Is it true that no number > 1049 = A215614(6) has a square with digit sum less than 9, other than the trivial 1 and 4?

Crossrefs

Cf. A004159 (sum of digits of n^2), A215614 (sumdigits(n^2) = 7), A133472 (10^n + 5), A199685 (5*10^n + 1), A052216 (10^a + 10^b), A237424 ((10^a + 10^b + 1)/3).
See also: A058414 (digits(n^2) in {0,1,4}).

Programs

  • PARI
    select( {is_A384094(n)=n%10 && sumdigits(n^2)==9}, [1..10^5])

A383182 a(n) = 2^n - A129629(n+1).

Original entry on oeis.org

0, 1, 1, 1, 2, 1, 1, 5, 1, 1, 9, 1, 4, 16, 1, 1, 33, 11, 1, 65, 1, 1, 142, 1, 8, 257, 1, 35, 513, 1, 1, 1038, 67, 1, 2049, 1, 1, 4220, 39, 1, 8192, 1, 259, 16385, 1, 71, 32769, 515, 1, 65550, 1, 1, 132211, 1, 1, 262145, 1, 2051, 524302, 263, 32, 1048577, 4096, 1, 2097153, 1, 519, 4202480, 1, 1
Offset: 0

Author

M. F. Hasler, May 27 2025

Keywords

Comments

We observe that 2^(n-1) - A129629(n) often equals 1, and otherwise this difference is often the sum of only one or two distinct powers of two.

Crossrefs

Cf. A129629.

Programs

A384100 a(n) is the least positive x such that x^3 + x + n^2 is a perfect square, or 0 if no such x exists.

Original entry on oeis.org

0, 72, 4128, 8, 262272, 1000200, 44, 7529928, 16777728, 34012872, 64000800, 113380872, 191104128, 308917128, 12, 729001800, 4, 1544806728, 32, 3010939272, 4096003200, 8, 7256317728, 9474301128, 80, 15625005000, 19770615072, 24794917128, 30840985728, 38068699272
Offset: 0

Author

M. F. Hasler, May 19 2025

Keywords

Comments

Otherwise said, first component of the lexicographically earliest positive integer solution (x, y) to x^3 + x + n^2 = y^2. See A384101 for the second component, y.
For any positive n, there is always the solution (x, y) = (8*n^2*(8*n^4 + 1), n*(512*n^8 + 96*n^4 + 3)). Therefore 0 < a(n) <= 8*n^2*(8*n^4 + 1) for all n > 0.
We remark that n = 3 and n = 6 are the only cases below n = 10 for which there is a smaller solution than S(n) = (x, y) given above, while gcd(x, y) = gcd(n, 3) (= 3 iff n is divisible by 3, otherwise 1).

Examples

			For n = 0, there can't be any positive x for which x^3 + x = x*(x^2 + 1) = y^2, therefore a(0) = 0. (Indeed, x^2 + 1 == 1 (mod x), so x has no factor in common with x^2 + 1 = y^2/x, so x must be a square itself, x = m^2. But then, x^2 + 1 = (y/m)^2 can't have a solution, since x^2 + 1 can't be a square.)
For n = 1, we can check that for x = 1, 2, 3, ..., value of x^3 + x + 1 = 3, 10, 31, ... isn't a square for any x < 72 which is the least positive integer so that x^3 + x + 1 = 72*(72^2 + 1) + 1 = 373321 = (13*47)^2 is a perfect square, thus a(1) = 72.
For n = 2, there is no x < 4128 for which x^3 + x + 2^2 is a square, but 4128*(4128^2+1) + 4 = (2*132611)^2 is indeed the least square of that form, so a(2) = 4128. (As for n = 1, this is the upper limit for a(n), given in FORMULA.)
For n = 3, there is a(3) = x = 8 for which x^3 + x + 3^2 = 529 = 23^2 is a square, much smaller than the upper limit for a(n).
		

Crossrefs

Cf. A384101 (the corresponding y-values).

Programs

  • PARI
    apply({A384100(n)=for(x=1, 64*n^6+8*n^2, issquare(n^2+x^3+x) && return(x))}, [0..6])

Formula

a(n) <= 8*n^2*(8*n^4 + 1) for all n > 0.

Extensions

More terms from Jinyuan Wang, May 26 2025

A383184 Diamond spiral numbers of the grid points visited by a king always moving to the unvisited point labeled with the smallest possible prime or else composite number.

Original entry on oeis.org

0, 2, 3, 11, 23, 4, 5, 13, 12, 24, 41, 61, 40, 59, 83, 60, 84, 113, 85, 86, 62, 25, 26, 43, 14, 1, 7, 17, 31, 8, 19, 9, 10, 37, 21, 20, 53, 34, 33, 18, 32, 71, 97, 127, 72, 73, 50, 49, 48, 47, 29, 6, 15, 16, 30, 69, 68, 67, 28, 27, 44, 89, 64, 63, 42, 87, 88, 149, 116, 115, 114, 146, 223, 182, 181, 144, 179, 112, 111, 110, 109, 58, 38, 22, 57, 56, 79, 107, 139, 80, 81, 82, 39
Offset: 0

Author

M. F. Hasler, May 13 2025

Keywords

Comments

The infinite 2D grid is labeled along a diamond spiral as shown in A305258, starting with 0 at the origin (0,0), where each "shell" contains the points with given taxicab or L1-norm, as follows:
. (y)
2 | 8 17
| / \ \
1 | 9 2 7 16
| / / \ \ \
0 | 10 3 0--1 6 15
| \ \ / /
-1 | 11 4--5 14
| \ /
-2 | 12--13
x: -2 -1 0 1 2 3
.
(This numbering, where the n-th "shell" has only 4n numbers, is "finer" than the square spiral numbering where the n-th shell has 8n numbers.)
The cursor is moving like a chess king to the von Neumann neighbor not visited earlier and labeled with the smallest prime number if possible, otherwise with the smallest possible composite number.
After the 92th move, the cursor is trapped in the point (-1,-3) labeled a(92) = 39. All eight neighbors were then already visited earlier, so the king has no more any possible move: see the "path plot" given in the links section.

Examples

			From the starting point (0,0) labeled a(0) = 0, the king can reach the point (0,1) labeled 2, which is the smallest possible prime number, so a(1) = 2.
Then the king can reach (-1,0) labeled 3 which is the next smaller prime number, so a(2) = 3. From there it can go to (-1,-1) labeled 11 = a(3), and so on.
The king reaches (1,7) and (1,-9) before getting trapped at (-1,-3) from where there is no more any unvisited point among the 8 neighbors.
		

Crossrefs

Cf. A383183 (same with square spiral numbering).
Cf. A305258 (more details about the diamond spiral).

Programs

  • Python
    from sympy import isprime
    def diamond_number(z):
        x, y = int(z.real), int(z.imag); d = abs(x)+abs(y)
        return 2*d*(d-1)+((x if y<0 else d+y)if x>0 else 2*d-x if y>0 else 3*d-y)
    def A383184(n, moves=(1, 1+1j, 1j, 1j-1, -1, -1-1j, -1j, 1-1j)):
        if not hasattr(A:=A383184, 'terms'): A.terms=[0]; A.pos=0; A.path=[0]
        while len(A.terms) <= n:
            try: _,s,z = min((1-isprime(s), s, z) for d in moves if
                             (s := diamond_number(z := A.pos+d))not in A.terms)
            except ValueError:
                raise IndexError(f"Sequence has only {len(A.terms)} terms")
            A.terms.append(s); A.pos = z; A.path.append(z)
        return A.terms[n]
    A383184(999) # gives IndexError: Sequence has only 93 terms
    A383184.terms # shows the full sequence
    import matplotlib.pyplot as plt # this and following to plot the path:
    plt.plot([z.real for z in A383184.path], [z.imag for z in A383184.path])
    plt.show()