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-7 of 7 results.

A212598 a(n) = n - m!, where m is the largest number such that m! <= n.

Original entry on oeis.org

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

Views

Author

N. J. A. Sloane, May 22 2012

Keywords

Comments

The m in definition is given by A084558(n).
Sequence consists of numbers 0..A001563(n)-1 followed by numbers 0..A001563(n+1)-1, and so on. - Antti Karttunen, Dec 17 2012

Crossrefs

Programs

  • Maple
    f:=proc(n) local i; for i from 0 to n do if i! > n then break; fi; od; n-(i-1)!; end;
    [seq(f(n),n=1..70)];
  • PARI
    a(n)=my(m); while(m++!<=n,); n-(m-1)! \\ Charles R Greathouse IV, Sep 02 2015
  • Scheme
    (define (A212598 n) (- n (A000142 (A084558 n))))
    

Formula

a(n) = n-A000142(A084558(n)). - Antti Karttunen, Dec 17 2012

A212266 Primes p such that p - m! is composite, where m is the greatest number such that m! < p.

Original entry on oeis.org

59, 73, 79, 89, 101, 109, 197, 211, 239, 241, 263, 281, 307, 337, 367, 373, 379, 409, 419, 421, 439, 443, 449, 461, 463, 491, 523, 547, 557, 571, 593, 601, 613, 617, 631, 647, 653, 659, 673, 701, 709, 769, 797, 811, 839, 853, 863, 881, 907, 929, 937, 941, 967
Offset: 1

Views

Author

Balarka Sen, May 12 2012

Keywords

Comments

The first five terms 59, 73, 79, 89, 101 belong to A023209. The terms 409, 419, 421, 439, 443, 449 also belong to A127209.
It seems likely that a(n) ~ n log n, can this be proved? - Charles R Greathouse IV, Sep 20 2012

Examples

			29 is not a member because 29 - 4! = 5 is prime.
59 is a member because 59 - 4! = 35 is composite.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[200]],Module[{m=9},CompositeQ[While[m!>=#,m--];#-m!]]&] (* The initial m constant (set at 9 in the program) needs to be increased if the prime Range constant (set at 200 in the program) is increased beyond 30969. *) (* Harvey P. Dale, Dec 01 2023 *)
  • PARI
    for(n=3,5,N=n!;forprime(p=N+3,N*(n+1),if(!isprime(p-N), print1(p", ")))) \\ Charles R Greathouse IV, May 12 2012
    
  • PARI
    is_A212266(p)=isprime(p) && for(n=1,p, n!

    1)) \\ M. F. Hasler, May 20 2012

A137328 a(n) = prime(n) - primorial(k), where k is the greatest number for which primorial(k) <= prime(n).

Original entry on oeis.org

0, 1, 3, 1, 5, 7, 11, 13, 17, 23, 1, 7, 11, 13, 17, 23, 29, 31, 37, 41, 43, 49, 53, 59, 67, 71, 73, 77, 79, 83, 97, 101, 107, 109, 119, 121, 127, 133, 137, 143, 149, 151, 161, 163, 167, 169, 1, 13, 17, 19, 23, 29, 31, 41, 47, 53, 59, 61, 67, 71, 73, 83, 97, 101, 103, 107, 121
Offset: 1

Views

Author

Ctibor O. Zizka, Apr 07 2008

Keywords

Comments

Conjecture: Each prime number appears in this sequence at least once.
Is there any general asymptotic formula for the appearance of prime(n) in this sequence?

Examples

			a(6) = prime(6) - primorial(2) = 13 - 6 = 7.
		

Crossrefs

Programs

  • Mathematica
    pn=FoldList[Times, 1, Prime[Range[5]]] (* Increase for n>343 *); a[n_]:=Module[{k=1},Until[pn[[k]]>Prime[n],k++];Prime[n]-pn[[k-1]]];Array[a,67] (* James C. McMahon, May 28 2025 *)
  • PARI
    a(n) = {my(p=prime(n), q=1, P=1); until (P > p, q = nextprime(q+1); P *= q;); p - P/q;} \\ Michel Marcus, Mar 14 2022
    
  • Python
    from sympy import nextprime
    from itertools import islice
    def agen(): # generator of terms
        pn, primk, pk, pkplus = 2, 2, 2, 3
        while True:
            while primk * pkplus <= pn:
                primk, pk, pkplus = primk*pkplus, pkplus, nextprime(pkplus)
            yield pn - primk
            pn = nextprime(pn)
    print(list(islice(agen(), 67))) # Michael S. Branicky, Mar 14 2022

A137330 a(n) = primorial(k) - prime(n) where k is the smallest number for which prime(n) <= primorial(k).

Original entry on oeis.org

0, 3, 1, 23, 19, 17, 13, 11, 7, 1, 179, 173, 169, 167, 163, 157, 151, 149, 143, 139, 137, 131, 127, 121, 113, 109, 107, 103, 101, 97, 83, 79, 73, 71, 61, 59, 53, 47, 43, 37, 31, 29, 19, 17, 13, 11, 2099, 2087, 2083, 2081, 2077, 2071, 2069, 2059, 2053, 2047, 2041
Offset: 1

Views

Author

Ctibor O. Zizka, Apr 07 2008

Keywords

Comments

Does each prime number appear in this sequence at least once?
Answer to previous: Neither 2 nor 5 will appear, as no prime > 5 can end in a 5 or be even. - Bill McEachen, Dec 05 2020

Examples

			a(6) = primorial(3) - prime(6) = 30-13 = 17.
		

Crossrefs

Programs

  • Mathematica
    Block[{a = {}, P = 2, j = 1}, Do[AppendTo[a, If[# > P, j++; P *= Prime[j], P] - #] &@ Prime[n], {n, 57}]; a] (* Michael De Vlieger, Dec 07 2020 *)
  • PARI
    a(n) = {my(pp=2, k=1, p=prime(n)); while (pp < p, k++; pp*=prime(k)); pp-p;} \\ Michel Marcus, Dec 06 2020

A346425 a(n) is the greatest number k such that k! <= prime(n).

Original entry on oeis.org

2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
Offset: 1

Views

Author

Bernard Schott, Jul 16 2021

Keywords

Comments

Terms 2, 3, 4, 5, ... appear respectively 3, 6, 21, 98, ... times consecutively; indeed, 2 appears A061232(1) + A061232(2) times, then every m >= 3 appears A061232(m) times.

Examples

			prime(1) = 2 and the greatest k with k! <= 2 is 2, so a(1) = 2.
prime(4) = 7 and the greatest k with k! <= 7 is 3, so a(4) = 3.
prime(10) = 29 and the greatest k with k! <= 29 is 4 so a(10) = 4.
Rows with n, prime(n), greatest k! <=n, a(n) for n = 1..14
      n        1    2    3    4    5    6    7    8    9   10   11   12   13   14
   prime(n)    2    3    5    7   11   13   17   19   23   29   31   37   41   43
  greatest k!  2    2    2    6    6    6    6    6    6   24   24   24   24   24
    a(n)       2    2    2    3    3    3    3    3    3    4    4    4    4    4
		

Crossrefs

Programs

  • PARI
    a(n) = my(k=1); until (k! > prime(n), k++); k-1; \\ Michel Marcus, Jul 19 2021

Formula

a(n)! = A000040(n) - A136437(n).

A137321 a(n) = prime(n)^prime(n) - k!, where prime(n) is the n-th prime number, and k is the greatest number for which k! <= prime(n)^prime(n).

Original entry on oeis.org

2, 3, 2405, 460663, 198133379411, 281952316704253, 776149319714627324177, 1357971253927074149763979, 12038706006108210079811416910567, 2195692826371309917093828766580180926483469, 16546151513256634846850635804959240464844734431, 5052512795965694464228024657195578053165744330410199442517
Offset: 1

Views

Author

Ctibor O. Zizka, Apr 06 2008

Keywords

Examples

			a(3) = prime(3)^prime(3) - 6! = 5^5 - 720 = 3125 - 720 = 2405.
		

Crossrefs

Programs

  • Mathematica
    With[{f=Range[60]!},Table[p^p-Max[Select[f,#Harvey P. Dale, Aug 11 2023 *)
  • PARI
    a(n) = my(k=1, P=prime(n)^prime(n)); until (k! > P, k++); P - (k-1)!; \\ Michel Marcus, Mar 15 2022

Extensions

Name corrected and more terms from Michel Marcus, Mar 15 2022

A137322 a(n) = k! - A051674(n), where k is the smallest number for which A051674(n) <= k! where A051674(n) = prime(n)^prime(n).

Original entry on oeis.org

2, 93, 1915, 2805257, 1022362697389, 52812321503747, 296760465891270915823, 13532790387670672394876021, 244372391812343146601953447089433, 11196066938065133911754151366849886273516531, 3328707950474207400029638710843582600755265569
Offset: 1

Views

Author

Ctibor O. Zizka, Apr 06 2008

Keywords

Examples

			a(4) = 10! - prime(4)^prime(4) = 3628800 - 823543 = 2805257.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{p = Prime[n]^Prime[n], k = 1}, While[k! < p, k++]; k! - p]; Array[a, 11] (* Amiram Eldar, Mar 12 2022 *)
  • PARI
    f(n) = my(p = prime(n)); p^p;
    a(n) = my(k=1, P=f(n)); until(k! >= P, k++); k!-P; \\ Michel Marcus, Mar 12 2022

Extensions

Corrected and extended by Michel Marcus, Mar 12 2022
Showing 1-7 of 7 results.