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: Lars Blomberg

Lars Blomberg's wiki page.

Lars Blomberg has authored 229 sequences. Here are the ten most recent ones:

A375817 In an n X n grid draw straight walls between cells, starting at a border, such that the resulting figure is connected and has only one-cell wide paths; a(n) is the number of solutions not reduced for symmetries.

Original entry on oeis.org

1, 4, 56, 1112, 25000, 607712, 15918280, 451371888, 13908978792, 466254401360, 16972978214456, 668532916285104, 28362769354991656, 1290007395847848160, 62619708755213093360, 3230982278203826268640, 176553522584025285715304, 10184062836771923067636528
Offset: 1

Author

Lars Blomberg, Aug 30 2024

Keywords

Comments

This sequence contains some, but not all of the spanning trees in A007341, a(n)<A007341(n), for n>2.
See A375770 for examples.

Examples

			a(3) = 56. The A375770(3) = 10 distinct solutions with their multiplicities are:
  ._._._.   ._._._.   ._._._.   ._._._.   ._._._.
  |     |   |   | |   |   | |   | | | |   |   ._|
  | | | |   | |   |   | | | |   |     |   | |   |
  |_|_|_|   |_|_|_|   |_|_._|   |_|_|_|   |_|_|_|
    (4)       (8)       (4)       (2)       (8)
  ._._._.   ._._._.   ._._._.   ._._._.   ._._._.
  | | ._|   |   | |   |   ._|   |_. ._|   |_. | |
  |     |   | | ._|   | | ._|   |     |   |   ._|
  |_|_|_|   |_|_._|   |_|_._|   |_|_|_|   |_|_._|
    (8)       (8)       (8)       (4)       (2)
		

Crossrefs

Main diagonal of A375858.
Cf. A007341, A375770 (up to rotations and reflections), A375859 (up to rotations), A375860 (up to symmetries of the rectangle).

Programs

Extensions

Terms corrected and extended by Andrew Howroyd, Sep 03 2024

A375770 In an n X n grid draw straight walls between cells, starting at a border, such that the resulting figure is connected and has only one-cell wide paths; a(n) is the number of solutions distinct under reflections and rotations.

Original entry on oeis.org

1, 1, 10, 149, 3177, 76258, 1991098, 56431302, 1738662461, 58282168670, 2121623710614, 83566630166058, 3545346228604588, 161250925229195536, 7827463597195165900, 403872784815626357788, 22069190323151660044413, 1273007854598883147607470, 77288239799225577008977654
Offset: 1

Author

Lars Blomberg, Aug 27 2024

Keywords

Comments

This sequence contains some, but not all of the spanning trees in A349718.

Examples

			a(2)=1:
+=======+
| o - o |
| |   | |
| o ║ o |
+===+===+
a(3)=10:
+===========+  +=======+===+  +=======+===+  +===+===+===+  +===========+
| o - o - o |  | o - o ║ o |  | o - o ║ o |  | o ║ o ║ o |  | o - o - o |
| |   |   | |  | |   |   | |  | |   | ║ | |  | |   |   | |  | |   |   ══+
| o ║ o ║ o |  | o ║ o - o |  | o ║ o ║ o |  | o - o - o |  | o ║ o - o |
| | ║ | ║ | |  | | ║ |   | |  | | ║ |   | |  | |   |   | |  | | ║ |   | |
| o ║ o ║ o |  | o ║ o ║ o |  | o ║ o - o |  | o ║ o ║ o |  | o ║ o ║ o |
+===+===+===+  +===+===+===+  +===+=======+  +===+===+===+  +===+===+===+
+===+=======+  +=======+===+  +===========+  +===========+  +=======+===+
| o ║ o - o |  | o - o ║ o |  | o - o - o |  | o - o - o |  | o - o ║ o |
| |   |   ══+  | |   |   | |  | |   |   ══+  +═══  |   ══+  +═══  |   | |
| o - o - o |  | o ║ o - o |  | o ║ o - o |  | o - o - o |  | o - o - o |
| |   |   | |  | | ║ |   ══+  | | ║ |   ══+  | |   |   | |  | |   |   ══+
| o ║ o ║ o |  | o ║ o - o |  | o ║ o - o |  | o ║ o ║ o |  | o ║ o - o |
+===+===+===+  +===+=======+  +===+=======+  +===+===+===+  +===+=======+
n=4 sample
+===+===+===+===+  +=======+===+===+
| o ║ o ║ o ║ o |  | o - o ║ o ║ o |
| |   |   |   | |  +═══  | ║ |   | |
| o - o - o - o |  | o - o ║ o - o |
+═══  |   |   ══+  | |   | ║ |   ══+
| o - o ║ o - o |  | o ║ o ║ o - o |
| |   | ║ |   ══+  | | ║ |   |   | |
| o ║ o ║ o - o |  | o ║ o - o ║ o |
+===+===+=======+  +===+=======+===+
n=5 sample
+===+===+===+===+===+
| o ║ o ║ o ║ o ║ o |
| |   | ║ | ║ |   | |
| o - o ║ o ║ o - o |
| |   |   |   |   ══+
| o ║ o - o - o - o |
| | ║ |   |   |   ══+
| o ║ o ║ o ║ o - o |
| | ║ | ║ | ║ |   | |
| o ║ o ║ o ║ o ║ o |
+===+===+===+===+===+
n=6 sample
+===========+===+===+===+
| o - o - o ║ o ║ o ║ o |
| |   |   | ║ | ║ | ║ | |
| o ║ o ║ o ║ o ║ o ║ o |
| | ║ | ║ |   |   | ║ | |
| o ║ o ║ o - o - o ║ o |
| | ║ | ║ |   |   | ║ | |
| o ║ o ║ o ║ o ║ o ║ o |
| | ║ | ║ | ║ | ║ |   | |
| o ║ o ║ o ║ o ║ o - o |
| | ║ | ║ | ║ | ║ |   ══+
| o ║ o ║ o ║ o ║ o - o |
+===+===+===+===+=======+
Examples of spanning trees where some of the walls do not start at a border, so they are not included in this sequence.
+===+===+=======+  +===============+
| o ║ o ║ o - o |  | o - o - o - o |
| | ║ |   |   | |  +══════════   | |
| o ║ o - o ║ o |  | o - o - o ║ o |
| | ║ ═════ ║ | |  | |   ══  | ║ | |
| o ║ o - o ║ o |  | o ║ o - o ║ o |
| |   |   | ║ | |  | |   ═════   | |
| o - o ║ o - o |  | o - o - o - o |
+=======+=======+  +===============+
		

Crossrefs

Cf. A349718, A375817 (not reduced for symmetries), A375859 (up to rotations), A375860 (up to symmetries of rectangle).

Programs

Extensions

a(1) set to 1 and a(9) onwards from Andrew Howroyd, Aug 31 2024

A363577 Number of inequivalent Hamiltonian paths starting in the lower left corner of an n X n grid graph (paths differing only by rotations and reflections are regarded as equivalent).

Original entry on oeis.org

1, 1, 3, 23, 347, 10199, 683227, 85612967, 25777385143, 14396323278040, 19799561204761862, 50351228336401026361, 319210377672595552740369, 3736517399241599771428011100, 109790442395888863208285555153329, 5952238893391106787883489313797219949
Offset: 1

Author

Lars Blomberg, Jun 10 2023

Keywords

Comments

Equivalently, number of inequivalent Hamiltonian paths starting in a corner of an n X n grid graph (paths differing only by rotations and reflections are regarded as equivalent). - Martin Ehrenstein, Jul 08 2023

Examples

			There are 3 paths for n=3:
  +--+--+    +--+--+    +--+  +
  |     |    |     |    |  |  |
  +  +  +    +  +--+    +  +  +
  |  |  |    |  |       |  |  |
  +  +--+    +  +--+    +  +--+
A fourth path:
  +--+--+
        |
  +--+  +
  |  |  |
  +  +--+
is the same as the second one in the row above after a 90-degree rotation.
All paths starting E are the same as the corresponding ones starting N after reflection in the forward diagonal.
		

Extensions

a(1) added by N. J. A. Sloane, Jun 10 2023
a(8)-a(9) from Martin Ehrenstein, Jul 08 2023
a(10)-a(16) from Oliver R. Bellwood, Jun 06 2025

A351532 Number of integer pairs (i, j), 0 < i, j < n, such that i/(n - i) + j/(n - j) = 1.

Original entry on oeis.org

0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 2, 5, 0, 0, 1, 2, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 2, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 5, 0, 0, 1, 0, 2, 1, 0, 2, 1, 0, 0, 3, 0, 0, 1, 0, 0, 7, 0, 0, 1, 0, 0, 1, 0, 0, 1, 2, 0, 1, 0, 2, 3
Offset: 1

Author

Lars Blomberg, Feb 14 2022

Keywords

Comments

By symmetry, if (i, j) is a solution then so is (j, i). When j=i we get n = 3i, corresponding to the solution 1/2 + 1/2 = 1. Therefore, when 3|n, a(n) > 0 and odd, otherwise a(n) >= 0 and even.
For n < 10^6, the largest term is a(720720) = 285, and 483188 terms are 0.
Other record terms: a(1081080) = 369, a(2162160) = 457, a(3243240) = 481, a(4324320) = 533, a(5405400) = 559, a(6126120) = 597. Record terms with index >= 360360 appear to occur at indices that are multiples of 180180. - Chai Wah Wu, Feb 15 2022

Examples

			For n = 3: (i, j) = (1, 1), so a(3) = 1. (1/2 + 1/2 = 1)
For n = 18: (i, j) = (3, 8), (6, 6), (8, 3), so a(18) = 3. (3/15 + 8/10 = 1/5 + 4/5 = 1)
For n = 20: (i, j) = (5, 8), (8, 5), so a(20) = 2.
For n = 36: (i, j) = (6, 16), (8, 15), (12, 12), (15, 8), (16, 6), so a(36) = 5.
		

Crossrefs

Programs

  • PARI
    a(n)={my(x=n^2, y=2*n); sum(i=1,(n-1)/2, x-=2*n; y-=3; if(x%y==0,1,0))}
    
  • Python
    from sympy.abc import i, j
    from sympy.solvers.diophantine.diophantine import diop_quadratic
    def A351532(n):
        return sum(1 for d in diop_quadratic(n**2+3*i*j-2*n*(i+j)) if 0 < d[0] < n and 0 < d[1] < n) # Chai Wah Wu, Feb 15 2022

Formula

The original equation can be solved for j giving j = (n(n - 2i)) / (2n - 3i). Varying i from 1 to n-1, a(n) is given by the number of integer values of j, 0 < j < n.

Extensions

Data section extended up to a(105) by Antti Karttunen, Jan 17 2025

A349575 Triangle read by rows: T(w,h) (for w >= h >= 1) is the number of distinct sets of rectangles with integer sides that tile the w X h rectangle.

Original entry on oeis.org

1, 2, 4, 3, 10, 21, 5, 22, 73, 191, 7, 44, 190, 698, 1999, 11, 91, 507, 2276, 8498, 27016, 15, 172, 1176, 6647, 29688, 116593, 390304, 22, 326, 2845, 18820, 100160, 454677, 1805924
Offset: 1

Author

Lars Blomberg, Nov 22 2021

Keywords

Comments

The position and orientation of each rectangle in a tiling is irrelevant. Squares are allowed.
The first column is A000041 since tiling the n X 1 rectangle (ignoring the order of the tiles) is the same thing as partitioning its length n.

Examples

			Triangle begins
   1
   2   4
   3  10   21
   5  22   73   191
   7  44  190   698   1999
  11  91  507  2276   8498  27016
  15 172 1176  6647  29688 116593  390304
  22 326 2845 18820 100160 454677 1805924 ...
For w=4, h=4, 3 tiles: one 2 X 1, one 3 X 2, one 4 X 2
  aaaa
  aaaa
  bbbc
  bbbc
For w=8, h=7, 14 tiles: one 1 X 1, one 2 X 1, one 2 X 2, six 3 X 1, two 4 X 1, one 4 X 3, one 5 X 1, one 6 X 1
  aaaagggl
  aaaaffkl
  aaaaffkl
  bbbbbbkn
  cccccjjj
  ddddhhhm
  eeeeiiim
		

Crossrefs

A348561 Primes where every other digit is 9 starting with the rightmost digit, and no other digit is 9.

Original entry on oeis.org

19, 29, 59, 79, 89, 919, 929, 1949, 1979, 2909, 2939, 2969, 3919, 3929, 3989, 4909, 4919, 4969, 5939, 6949, 6959, 7919, 7949, 8929, 8969, 90989, 91909, 91939, 91969, 92959, 93949, 93979, 94949, 95929, 95959, 95989, 96959, 96979, 96989, 97919, 98909, 98929
Offset: 1

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f9:=func;  fc:=func; [p:p in PrimesUpTo(100000)|f9(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
    
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={9}&&FreeQ[Flatten@Last@t,9])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
    id[n_]:=IntegerDigits[n];il[n_]:=IntegerLength[n];eQ[n_]:=EvenQ[il[n]]&&AllTrue[Flatten[Position[id[n],9]],EvenQ]&&Length[Cases[id[n],9]]==il[n]/2;oQ[n_]:=OddQ[il[n]]&&
    AllTrue[Flatten[Position[id[n],9]],OddQ]&&Length[Cases[id[n],9]]==(il[n]+1)/2;
    Select[Prime[Range[10^5]],oQ[#]||eQ[#]&] (* Ivan N. Ianakiev, Oct 24 2021 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '9' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '9' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 98930)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo9(maxdigits): # generator for every other digit is 7, no other 7's
        yield 9
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "12345678":
                    f9 = f + "9"
                    for p in product("012345678", repeat=(d-1)//2):
                        yield int(f9 + "".join(p[i]+"9" for i in range(len(p))))
            else:
                for p in product("012345678", repeat=(d-1)//2):
                    yield int("9" + "".join(p[i]+"9" for i in range(len(p))))
    print(list(filter(isprime, eo9(5)))) # Michael S. Branicky, Oct 22 2021

A348560 Primes where every other digit is 7 starting with the rightmost digit, and no other digit is 7.

Original entry on oeis.org

7, 17, 37, 47, 67, 97, 727, 757, 787, 797, 1747, 1787, 2707, 2767, 2797, 3727, 3767, 3797, 4787, 5717, 5737, 6737, 8707, 8737, 8747, 9767, 9787, 70717, 71707, 72707, 72727, 72767, 72797, 73727, 73757, 74707, 74717, 74747, 74797, 75707, 75767, 75787, 75797
Offset: 1

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f7:=func;  fc:=func; [p:p in PrimesUpTo(80000)|f7(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
    
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={7}&&FreeQ[Flatten@Last@t,7])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '7' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '7' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 75798)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo7(maxdigits): # generator for every other digit is 7, no other 7's
        yield 7
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "12345689":
                    f7 = f + "7"
                    for p in product("012345689", repeat=(d-1)//2):
                        yield int(f7 + "".join(p[i]+"7" for i in range(len(p))))
            else:
                for p in product("012345689", repeat=(d-1)//2):
                    yield int("7" + "".join(p[i]+"7" for i in range(len(p))))
    print(list(filter(isprime, eo7(5)))) # Michael S. Branicky, Oct 22 2021

A348559 Primes where every other digit is 3 starting with the rightmost digit, and no other digit is 3.

Original entry on oeis.org

3, 13, 23, 43, 53, 73, 83, 313, 353, 373, 383, 1303, 1373, 2383, 2393, 4363, 4373, 5303, 5323, 5393, 6323, 6343, 6353, 6373, 7393, 8353, 8363, 9323, 9343, 30313, 30323, 31393, 32303, 32323, 32353, 32363, 34303, 34313, 35323, 35353, 35363, 35393, 36313, 36343
Offset: 1

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f3:=func;  fc:=func; [p:p in PrimesUpTo(40000)|f3(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
    
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={3}&&FreeQ[Flatten@Last@t,3])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '3' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '3' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 36344)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo3(maxdigits): # generator for every other digit is 3, no other 3's
        yield 3
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "12456789":
                    f3 = f + "3"
                    for p in product("012456789", repeat=(d-1)//2):
                        yield int(f3 + "".join(p[i]+"3" for i in range(len(p))))
            else:
                for p in product("012456789", repeat=(d-1)//2):
                    yield int("3" + "".join(p[i]+"3" for i in range(len(p))))
    print(list(filter(isprime, eo3(5)))) # Michael S. Branicky, Oct 22 2021

A348558 Primes where every other digit is 1 starting with the rightmost digit, and no other digit is 1.

Original entry on oeis.org

31, 41, 61, 71, 101, 131, 151, 181, 191, 2131, 2141, 2161, 3121, 3181, 3191, 5101, 5171, 6101, 6121, 6131, 6151, 7121, 7151, 8101, 8161, 8171, 8191, 9151, 9161, 9181, 10141, 10151, 10181, 12101, 12161, 13121, 13151, 13171, 15101, 15121, 15131, 15161, 16141
Offset: 1

Author

Lars Blomberg, Oct 22 2021

Keywords

Crossrefs

Programs

  • Magma
    f1:=func;  fc:=func; [p:p in PrimesUpTo(17000)|f1(p) and fc(p)]; // Marius A. Burtea, Oct 22 2021
  • Mathematica
    Select[Prime@Range@10000,(n=#;s={EvenQ,OddQ};t=Take[IntegerDigits@n,{#}]&/@Select[Range@i,#]&/@If[EvenQ[i=IntegerLength@n],s,Reverse@s];Union@Flatten@First@t=={1}&&FreeQ[Flatten@Last@t,1])&] (* Giorgos Kalogeropoulos, Oct 22 2021 *)
    eod1Q[p_]:=Module[{r=Reverse[IntegerDigits[p]]},Union[Take[r,{1,-1,2}]]=={1}&&FreeQ[ Take[ r,{2,-1,2}],1]]; Select[Prime[Range[2000]],eod1Q] (* Harvey P. Dale, May 28 2023 *)
  • Python
    from sympy import primerange as primes
    def ok(p):
        s = str(p)
        if not all(s[i] == '1' for i in range(-1, -len(s)-1, -2)): return False
        return all(s[i] != '1' for i in range(-2, -len(s)-1, -2))
    print(list(filter(ok, primes(1, 16142)))) # Michael S. Branicky, Oct 22 2021
    
  • Python
    # faster version for generating large initial segments of sequence
    from sympy import isprime
    from itertools import product
    def eo1(maxdigits): # generator for every other digit is 1, no other 1's
        yield 1
        for d in range(2, maxdigits+1):
            if d%2 == 0:
                for f in "23456789":
                    f1 = f + "1"
                    for p in product("023456789", repeat=(d-1)//2):
                        yield int(f1 + "".join(p[i]+"1" for i in range(len(p))))
            else:
                for p in product("023456789", repeat=(d-1)//2):
                    yield int("1" + "".join(p[i]+"1" for i in range(len(p))))
    print(list(filter(isprime, eo1(5)))) # Michael S. Branicky, Oct 22 2021
    

A346029 Primes that are the first in a run of exactly 9 emirps.

Original entry on oeis.org

7904639, 120890249, 154984343, 174625597, 312700789, 318629783, 707262887, 756791029, 923780981, 958610069, 1049344897, 1068171977, 1117675201, 1194919381, 1327765591, 1368391847, 1385828243, 1846629391, 1976590081, 3117896521, 3182618969, 3322051367
Offset: 1

Author

Lars Blomberg, Jul 14 2021

Keywords

Comments

There are large gaps in this sequence because all terms need to begin with 1, 3, 7, or 9 otherwise the reversal is composite.

Examples

			a(1) = 7904639 because of the 11 consecutive primes 7904629, 7904639, 7904651, 7904653, 7904657, 7904669, 7904683, 7904707, 7904719, 7904723, 7904731 all except 7904629 and 7904731 are emirps and this is the first such occurrence.
		

Crossrefs

Programs

  • Mathematica
    EmQ[n_]:=(s=IntegerReverse@n;PrimeQ@s&&n!=s);
    Monitor[Do[p=Prime@k;If[MemberQ[{1,3,7,9},First@IntegerDigits@p],If[Boole[EmQ/@NextPrime[p,Range[-1,9]]]==Join[{0},1~Table~9,{0}],Print@p]],{k,10^8}],p] (* Giorgos Kalogeropoulos, Jul 27 2021 *)
  • Python
    # uses code in A346026
    print(aupto(10**7, runlength=9)) # Michael S. Branicky, Jul 14 2021