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: Frank Hollstein

Frank Hollstein's wiki page.

Frank Hollstein has authored 3 sequences.

A367805 a(1) = 0; for n > 1, a(n) is the least positive integer k for which k*prime(n) + 2 is prime.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 1, 3, 3, 1, 5, 3, 1, 3, 7, 7, 1, 5, 5, 1, 5, 3, 3, 3, 3, 1, 3, 1, 5, 9, 3, 7, 1, 3, 1, 5, 5, 3, 3, 3, 1, 5, 1, 5, 1, 3, 9, 5, 1, 9, 3, 1, 15, 7, 3, 15, 1, 9, 11, 1, 9, 3, 21, 1, 3, 3, 5, 3, 1, 3, 3, 15, 3, 5, 9, 3, 13, 3, 19, 3, 1, 15, 1, 3, 3, 9, 13, 3, 1, 15
Offset: 1

Author

Frank Hollstein, Dec 01 2023

Keywords

Examples

			For n = 4: a(4) = 3, because prime(4) = 7, 3*7 + 2 = 23 which is prime.
		

Programs

  • Maple
    a:= proc(n) local p, q, r; p:= ithprime(n); q:= p;
          while irem(q-2, p, 'r')<>0 do q:= nextprime(q) od; r
        end:
    seq(a(n), n=1..99);  # Alois P. Heinz, Dec 04 2023
  • Mathematica
    nmax=90; a[1]=0; For[n=2, n<=nmax, n++, For[k=1, k>0, k++, If[PrimeQ[k*Prime[n]+2], a[n]=k; k=-1]]]; Array[a,nmax] (* Stefano Spezia, Dec 04 2023 *)
  • PARI
    a(n) = if (n==1, 0, my(k=1, p=prime(n)); while (!isprime(k*p+2), k++); k); \\ Michel Marcus, Dec 02 2023
    
  • Python
    from itertools import count, dropwhile
    from sympy import prime, isprime
    def A367805(n):
        if n==1:
            return 0
        else:
            p = prime(n)
            return next(dropwhile(lambda x:not isprime(x*p+2),count(1))) # Chai Wah Wu, Jan 04 2024

Formula

a(n) = (A279756(n) - 2)/A000040(n).
a(n) = 1 <=> n in A029707.

Extensions

More terms from Michel Marcus, Dec 02 2023

A355844 a(n) is the number of different self-avoiding (n-1)-move routes for a king on an empty n X n chessboard.

Original entry on oeis.org

1, 12, 160, 1764, 17280, 156484, 1335984, 10899404, 85743256, 654854660, 4880419048, 35632524244, 255652444992, 1806891645852, 12605286082848, 86939096972284, 593610191062680, 4016965725987052, 26965990393104248
Offset: 1

Author

Frank Hollstein, Jul 18 2022

Keywords

Examples

			n = 3
The squares are numbered as follows:
  0 1 2
  3 4 5
  6 7 8
By symmetry, only the routes starting from a corner square (e.g., square 0), one of the 4 side squares (e.g., square 1), and the 1 center square (square 4) need to be considered.
.
15 routes starting at square 0:
  012 015 014 013
  041 042 043 045 046 047 048
  031 034 036 037
.
19 routes starting at square 1:
  103 104
  124 125
  130 134 136 137
  140 142 143 145 146 147 148
  152 154 157 158
.
24 routes starting at square 4:
  401 403
  410 412 413 415
  421 425
  430 431 436 437
  451 452 457 458
  463 467
  473 475 476 478
  485 487
.
Total number of routes: 4*15 + 4*19 + 1*24 = 60 + 76 + 24 = 160.
		

Crossrefs

Extensions

a(12)-a(15) from Martin Ehrenstein, Sep 22 2022
a(16)-a(19) from Martin Ehrenstein, Sep 27 2022

A355127 a(n) is the number of different (n-1)-move routes for a king on an empty n X n chessboard.

Original entry on oeis.org

1, 12, 200, 2880, 37680, 455224, 5186888, 56471040, 593296160, 6057160296, 60407414256, 590807590672, 5684125083000, 53924502344880, 505415790232592, 4687367714152128, 43070861665247616, 392532002390446600, 3551337773634149120, 31920035670120464496
Offset: 1

Author

Frank Hollstein, Jun 20 2022

Keywords

Examples

			n = 2:
.
Numeration of squares on board:
  0 1
  2 3
.
By symmetry, the number of routes from each of the 4 starting squares is the same.
.
3 routes starting at square 0:
  01 02 03
.
Total number of routes: 4*3 = 12.
---------------------------------
n = 3:
Numeration of squares on board:
  0 1 2
  3 4 5
  6 7 8
.
Using symmetry, only the numbers of routes starting from one of the 4 corner squares (e.g., square 0), one of the 4 side squares (e.g., square 1), and the 1 center square (square 4) need to be considered.
.
18 routes starting at square 0:
  010 012 015 014 013
  040 041 042 043 045 046 047 048
  030 031 034 036 037
.
24 routes starting at square 1:
  101 103 104
  121 124 125
  131 130 134 136 137
  141 140 142 143 145 146 147 148
  151 152 154 157 158
.
32 routes starting at square 4:
  404 401 403
  414 410 412 413 415
  424 421 425
  434 430 431 436 437
  454 451 452 457 458
  464 463 467
  474 473 475 476 478
  484 485 487
.
Total number of routes: 4*18 + 4*24 + 1*32 = 72 + 96 + 32 = 200.
		

Crossrefs

Programs

  • Maple
    b:= proc(n, m, x, y) option remember; `if`(n=0, 1, add(
          add((s-> `if`({i, j}={0} or min(s)<1 or max(s)>m, 0,
            b(n-1, m, s[])))([x+i, y+j]), j=-1..1), i=-1..1))
        end:
    a:= n-> add(add(b(n-1, n, x, y), x=1..n), y=1..n):
    seq(a(n), n=1..20);  # Alois P. Heinz, Jun 20 2022
  • Mathematica
    b[n_, m_, x_, y_] := b[n, m, x, y] = If[n == 0, 1, Sum[Sum[With[{s = {x + i, y + j}}, If[Union@{i, j} == {0} || Min[s] < 1 || Max[s] > m, 0, b[n - 1, m, Sequence @@ s]]], {j, -1, 1}], {i, -1, 1}]];
    a[n_] := Sum[Sum[b[n - 1, n, x, y], {x, 1, n}], {y, 1, n}];
    Table[a[n], {n, 1, 20}] (* Jean-François Alcover, Sep 10 2022, after Alois P. Heinz *)

Formula

From Vaclav Kotesovec, Jul 18 2022: (Start)
Recurrence: (n-4) * (n-2) * (n-1)^2 * (6561*n^8 - 212139*n^7 + 2950263*n^6 - 23053977*n^5 + 110718549*n^4 - 334617561*n^3 + 621301485*n^2 - 647573195*n + 289741950)*a(n) = (n-2) * (98415*n^11 - 3621672*n^10 + 58904658*n^9 - 557565930*n^8 + 3401022330*n^7 - 13968918180*n^6 + 39146085342*n^5 - 74076664722*n^4 + 91284487995*n^3 - 67946473736*n^2 + 26218206060*n-3608592880)*a(n-1) - 2 * (951345*n^11 - 35042301*n^10 + 573945345*n^9 - 5517149841*n^8 + 34570186911*n^7 - 148143645873*n^6 + 442497763659*n^5 - 919659425931*n^4 + 1300075875920*n^3 - 1186236344006*n^2 + 625358201108*n-143083453680)*a(n-2) - 8 * (n-3) * (538002*n^11 - 20170701*n^10 + 335662947*n^9 - 3269686095*n^8 + 20693992482*n^7 - 89239225257*n^6 + 267100420161*n^5 - 553559634623*n^4 + 775814257936*n^3 - 696718449512*n^2 + 358050585284*n-78798884240)*a(n-3) + 64 * (n-4) * (39366*n^11 - 747954*n^10 + 1036638*n^9 + 95287104*n^8 - 1244227635*n^7 + 8077634280*n^6 - 32356061235*n^5 + 84721205046*n^4 - 145611420210*n^3 + 158260316980*n^2 - 98341752748*n + 26435972680)*a(n-4) + 512 * (n-5) * (n-3) * (118098*n^10 - 3864429*n^9 + 55834110*n^8 - 468708363*n^7 + 2528957700*n^6 - 9150957666*n^5 + 22446838206*n^4 - 36764880492*n^3 + 38348031900*n^2 - 22886883656*n + 5886448960)*a(n-5) + 8192 * (n-6) * (n-5) * (n-4) * (n-3) * (6561*n^8 - 159651*n^7 + 1648998*n^6 - 9439902*n^5 + 32737014*n^4 - 70335324*n^3 + 91203060*n^2 - 64949504*n + 19261936)*a(n-6).
a(n) ~ n^2 * 8^(n-1) * (1 - 2*sqrt(6/(Pi*n))). (End)

Extensions

a(11)-a(20) from Alois P. Heinz, Jun 20 2022