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.

Showing 1-2 of 2 results.

A073830 a(n) = 4*((n-1)! + 1) + n (mod n*(n + 2)).

Original entry on oeis.org

0, 2, 0, 8, 0, 10, 56, 12, 22, 14, 0, 16, 182, 18, 34, 20, 0, 22, 380, 24, 46, 26, 552, 28, 29, 30, 58, 32, 0, 34, 992, 36, 37, 38, 74, 40, 1406, 42, 82, 44, 0, 46, 1892, 48, 94, 50, 2256, 52, 53, 54, 106, 56, 2862, 58, 59, 60, 118, 62, 0, 64, 3782, 66, 67, 68, 134, 70
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 12 2002

Keywords

Crossrefs

Programs

  • Magma
    [(4*(Factorial(n-1)+1)+n) mod (n^2+2*n): n in [1..70]]; // Vincenzo Librandi, May 04 2014
  • Maple
    A073830 := proc(n)
        4*((n-1)!+1)+n ;
        modp(%,n*(n+2)) ;
    end proc:
    seq(A073830(n),n=1..60) ; # R. J. Mathar, Feb 21 2017
  • Mathematica
    a[n_] := Mod[4 ((n - 1)! + 1) + n, n (n + 2)]; Array[a, 66] (* Jean-François Alcover, Feb 22 2018 *)

Formula

a(n) = A073829(n) mod A005563(n).
For n > 1: a(n) = 0 iff (n, n+2) are twin primes (Clement, 1949).
From Bernard Schott, Nov 16 2021: (Start)
If p is an odd prime, and p+2 is composite, then a(p) = p*(p+1).
If m is composite, and m+2 is prime, then a(m) = 2*(m+2).
If n even >= 4, a(n) = n + 4.
If p prime >= 5, a(p^2) = p^2 + 4. (End)

A073832 k between A001359(n) and A001359(n+1) such that A073830(k) is maximal.

Original entry on oeis.org

4, 7, 13, 23, 37, 53, 67, 97, 103, 131, 139, 173, 181, 193, 223, 233, 263, 277, 307, 337, 409, 421, 457, 509, 563, 593, 613, 631, 653, 797, 811, 823, 853, 877, 1013, 1021, 1039, 1051, 1087, 1129, 1223, 1259, 1283, 1297, 1307, 1423, 1447, 1471, 1483, 1601
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 12 2002

Keywords

Comments

A073830(a(n)) = A073831(n).

Programs

  • Maple
    A073832 := proc(n)
        local k,kmx,a ;
        kmx := 0 ;
        a := A001359(n)+1 ;
        for k from A001359(n)+1 to A001359(n+1)-1 do
            if A073830(k) > kmx then
                a := k ;
                kmx := A073830(k) ;
            end if;
        end do:
        a ;
    end proc:
    seq(A073832(n),n=1..50) ; # R. J. Mathar, Feb 21 2017
  • Mathematica
    f[n_] := Mod[4*((n - 1)! + 1) + n, n*(n + 2)];
    pp = Select[Prime[Range[300]], PrimeQ[# + 2] & ];
    a[n_] := MaximalBy[Range[pp[[n]], pp[[n + 1]]], f];
    Array[a, Length[pp] - 1] // Flatten (* Jean-François Alcover, Feb 22 2018 *)
  • Python
    from math import factorial
    from itertools import islice, pairwise
    from sympy import isprime, nextprime, primerange
    def f(n): return (4*(factorial(n-1) + 1) + n)%(n*(n + 2))
    def bgen(): # generator of A001359
        p, q = 2, 3
        while True:
            if q - p == 2: yield p
            p, q = q, nextprime(q)
    def agen(): # generator of terms
        for p, q in pairwise(bgen()):
            yield max((f(k), k) for k in range(p+1, q))[1]
    print(list(islice(agen(), 80))) # Michael S. Branicky, Aug 13 2024
Showing 1-2 of 2 results.