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

A175856 a(n) = a(n-1) - 1 if n is composite, a(n) = n otherwise.

Original entry on oeis.org

1, 2, 3, 2, 5, 4, 7, 6, 5, 4, 11, 10, 13, 12, 11, 10, 17, 16, 19, 18, 17, 16, 23, 22, 21, 20, 19, 18, 29, 28, 31, 30, 29, 28, 27, 26, 37, 36, 35, 34, 41, 40, 43, 42, 41, 40, 47, 46, 45, 44, 43, 42, 53, 52, 51, 50, 49, 48, 59, 58, 61, 60, 59, 58, 57, 56, 67, 66
Offset: 1

Views

Author

Jaroslav Krizek, Sep 29 2010

Keywords

Comments

a(n) = n for noncomposite n, a(n) = 2 * (previous prime (n)) - n for composite n.
See A175859 - absent positive integers (pairs of consecutive numbers) in sequence: 8, 9, 14, 15, 24, 25, 32, 33, ...
a(n) = A075365(n) except at n = 1 and n = 10. - Alexandre Herrera, Nov 11 2023

Examples

			a(7) = 7 (7 is a noncomposite number), a(8) = 2*7 - 8 = 6 (8 is composite).
		

Crossrefs

Programs

  • Maple
    a:= proc(n) option remember;
          `if`(n=1 or isprime(n), n, a(n-1)-1)
        end:
    seq(a(n), n=1..80);  # Alois P. Heinz, Jun 22 2021
  • Mathematica
    a[1] := 1; a[n_] := a[n] = If[PrimeQ[n], n, a[n - 1] - 1] (* Ben Branman, Jan 02 2011 *)
    nxt[{n_,a_}]:={n+1,If[CompositeQ[n+1],a-1,n+1]}; NestList[nxt,{1,1},70][[All,2]] (* Harvey P. Dale, Jan 01 2023 *)
  • PARI
    a(n)=if(n==1, 1, 2*precprime(n)-n) \\ Charles R Greathouse IV, Apr 22 2022~

Extensions

Corrected by Jaroslav Krizek, Oct 01 2010

A075366 Smallest product (n+1)(n+2)...(n+k) that is divisible by the product of all the primes up to n.

Original entry on oeis.org

1, 12, 120, 30, 30240, 5040, 17297280, 2162160, 240240, 360360, 28158588057600, 2346549004800, 64764752532480000, 4626053752320000, 308403583488000, 19275223968000, 830034394580628357120000, 46113021921146019840000
Offset: 1

Views

Author

Amarnath Murthy, Sep 20 2002

Keywords

Crossrefs

Programs

  • Haskell
    a075366 n = a075366_list !! (n-1)
    a075366_list = 1 : f 2 1 a000040_list where
       f x pp ps'@(p:ps)
         | p <= x    = f x (p * pp) ps
         | otherwise = g $ dropWhile (< pp) $ scanl1 (*) [x+1, x+2 ..]
         where g (z:zs) | mod z pp == 0 = z : f (x + 1) pp ps'
                        | otherwise     = g zs
    -- Reinhard Zumkeller, May 18 2015
  • Mathematica
    a75365[n_] := Module[{div, k, pr}, div=Times@@Prime/@Range[PrimePi[n]]; For[k=0; pr=1, True, k++; pr*=n+k, If[Mod[pr, div]==0, Return[k]]]]; a[n_] := Times@@Range[n+1, n+a75365[n]]

Formula

If p <= n < q, where p and q are consecutive primes, then a(n) = (2p)!/n!, unless n=10.

Extensions

Edited by Dean Hickerson, Oct 28 2002

A075367 Smallest value of lcm(n+1, n+2, ..., n+k) (for k >= 0) that is divisible by the product of all the primes up to n.

Original entry on oeis.org

1, 12, 60, 30, 2520, 2520, 360360, 180180, 60060, 60060, 232792560, 232792560, 26771144400, 26771144400, 26771144400, 13385572200, 144403552893600, 144403552893600, 5342931457063200, 5342931457063200, 5342931457063200
Offset: 1

Views

Author

Amarnath Murthy, Sep 20 2002

Keywords

Crossrefs

Programs

  • Mathematica
    a75365[n_] := Module[{div, k, pr}, div=Times@@Prime/@Range[PrimePi[n]]; For[k=0; pr=1, True, k++; pr*=n+k, If[Mod[pr, div]==0, Return[k]]]]; a[1]=1; a[n_] := LCM@@Range[n+1, n+a75365[n]]

Formula

a(n) = lcm(n+1, ..., n + A075365(n)).

Extensions

Edited by Dean Hickerson, Oct 28 2002

A075368 Smallest integer value of lcm(n+1, n+2, ..., n+k) (for k >= 0) divided by the product of all the primes up to n.

Original entry on oeis.org

1, 6, 10, 5, 84, 84, 1716, 858, 286, 286, 100776, 100776, 891480, 891480, 891480, 445740, 282861360, 282861360, 550835280, 550835280, 550835280, 550835280, 42222721680, 42222721680, 8444544336, 8444544336, 2814848112, 2814848112
Offset: 1

Views

Author

Amarnath Murthy, Sep 20 2002

Keywords

Examples

			a(3) = 10 as the product of primes <= (n = 3) is 6 and the smallest integer of the form lcm(3+1, 3+2, ..., 3+k) = lcm(4, 5, 6) = 60 giving a(3) = 60/6 = 10. - _David A. Corneth_, Dec 05 2023
		

Crossrefs

Programs

  • Mathematica
    a75365[n_] := Module[{div, k, pr}, div=Times@@Prime/@Range[PrimePi[n]]; For[k=0; pr=1, True, k++; pr*=n+k, If[Mod[pr, div]==0, Return[k]]]]; a[1]=1; a[n_] := LCM@@Range[n+1, n+a75365[n]]/Times@@Prime/@Range[PrimePi[n]]
  • PARI
    a(n) = {if(n==1, return(1));
    	my(pp = vecprod(primes(primepi(n))), l = n+1);
    	for(k = n+2, 2*n,
    		l = lcm(l, k);
    		if(l%pp == 0,
    			return(l\pp)
    		)
    	)
    } \\ David A. Corneth, Dec 05 2023

Formula

a(n) = A075367(n)/A034386(n).

Extensions

Edited by Dean Hickerson, Oct 28 2002
Showing 1-4 of 4 results.