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

A005867 a(0) = 1; for n > 0, a(n) = (prime(n)-1)*a(n-1).

Original entry on oeis.org

1, 1, 2, 8, 48, 480, 5760, 92160, 1658880, 36495360, 1021870080, 30656102400, 1103619686400, 44144787456000, 1854081073152000, 85287729364992000, 4434961926979584000, 257227791764815872000, 15433667505888952320000
Offset: 0

Views

Author

Keywords

Comments

Local minima of Euler's phi function. - Walter Nissen
Number of potential primes in a modulus primorial(n+1) sieve. - Robert G. Wilson v, Nov 20 2000
Let p=prime(n) and let p# be the primorial (A002110), then it can be shown that any p# consecutive numbers have exactly a(n-1) numbers whose lowest prime factor is p. For a proof, see the "Proofs Regarding Primorial Patterns" link. For example, if we let p=7 and consider the interval [101,310] containing 210 numbers, we find the 8 numbers 119, 133, 161, 203, 217, 259, 287, 301. - Dennis Martin (dennis.martin(AT)dptechnology.com), Jul 16 2006
From Gary W. Adamson, Apr 21 2009: (Start)
Equals (-1)^n * (1, 1, 1, 2, 8, 48, ...) dot (-1, 2, -3, 5, -7, 11, ...).
a(6) = 480 = (1, 1, 1, 2, 8, 48) dot (-1, 2, -3, 5, -7, 11) = (-1, 2, -3, 10, -56, 528). (End)
It can be proved that there are at least T prime numbers less than N, where the recursive function T is: T = N - N*Sum_{i=0..T(sqrt(N))} A005867(i)/A002110(i). This can show for example that at least 0.16*N numbers are primes less than N for 29^2 > N > 23^2. - Ben Paul Thurston, Aug 23 2010
First column of A096294. - Eric Desbiaux, Jun 20 2013
Conjecture: The g.f. for the prime(n+1)-rough numbers (A000027, A005408, A007310, A007775, A008364, A008365, A008366, A166061, A166063) is x*P(x)/(1-x-x^a(n)+x^(a(n)+1)), where P(x) is an order a(n) polynomial with symmetric coefficients (i.e., c(0)=c(n), c(1)=c(n-1), ...). - Benedict W. J. Irwin, Mar 18 2016
a(n)/A002110(n+1) (primorial(n+1)) is the ratio of natural numbers whose smallest prime factor is prime(n+1); i.e., prime(n+1) coprime to A002110(n). So the ratio of even numbers to natural numbers = 1/2; odd multiples of 3 = 1/6; multiples of 5 coprime to 6 (A084967) = 2/30 = 1/15; multiples of 7 coprime to 30 (A084968) = 8/210 = 4/105; etc. - Bob Selcoe, Aug 11 2016
The 2-adic valuation of a(n) is A057773(n), being sum of the 2-adic valuations of the product terms here. - Kevin Ryde, Jan 03 2023
For n > 1, a(n) is the number of prime(n+1)-rough numbers in [1, primorial(prime(n))]. - Alexandre Herrera, Aug 29 2023

Examples

			a(3): the mod 30 prime remainder set sieve representation yields the remainder set: {1, 7, 11, 13, 17, 19, 23, 29}, 8 elements.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A057773 (2-adic valuation).
Column 1 of A281890.

Programs

  • Haskell
    a005867 n = a005867_list !! n
    a005867_list = scanl (*) 1 a006093_list
    -- Reinhard Zumkeller, May 01 2013
  • Maple
    A005867 := proc(n)
        mul(ithprime(j)-1,j=1..n) ;
    end proc: # Zerinvary Lajos, Aug 24 2008, R. J. Mathar, May 03 2017
  • Mathematica
    Table[ Product[ EulerPhi[ Prime[ j ] ], {j, 1, n} ], {n, 1, 20} ]
    RecurrenceTable[{a[0]==1,a[n]==(Prime[n]-1)a[n-1]},a,{n,20}] (* Harvey P. Dale, Dec 09 2013 *)
    EulerPhi@ FoldList[Times, 1, Prime@ Range@ 18] (* Michael De Vlieger, Mar 18 2016 *)
  • PARI
    for(n=0, 22, print1(prod(k=1,n, prime(k)-1), ", "))
    

Formula

a(n) = phi(product of first n primes) = A000010(A002110(n)).
a(n) = Product_{k=1..n} (prime(k)-1) = Product_{k=1..n} A006093(n).
Sum_{n>=0} a(n)/A002110(n+1) = 1. - Bob Selcoe, Jan 09 2015
a(n) = A002110(n)-((1/A000040(n+1) - A038110(n+1)/A038111(n+1))*A002110(n+1)). - Jamie Morken, Mar 27 2019
a(n) = |Sum_{k=0..n} A070918(n,k)|. - Alois P. Heinz, Aug 18 2019
a(n) = A058251(n)/A060753(n+1). - Jamie Morken, Apr 25 2022
a(n) = A002110(n) - A016035(A002110(n)) - 1 for n >= 1. - David James Sycamore, Sep 07 2024
Sum_{n>=0} 1/a(n) = A345974. - Amiram Eldar, Jun 26 2025

Extensions

Offset changed to 0, Name changed, and Comments and Examples sections edited by T. D. Noe, Apr 04 2010

A219428 a(n) = n - 1 - phi(n).

Original entry on oeis.org

-1, 0, 0, 1, 0, 3, 0, 3, 2, 5, 0, 7, 0, 7, 6, 7, 0, 11, 0, 11, 8, 11, 0, 15, 4, 13, 8, 15, 0, 21, 0, 15, 12, 17, 10, 23, 0, 19, 14, 23, 0, 29, 0, 23, 20, 23, 0, 31, 6, 29, 18, 27, 0, 35, 14, 31, 20, 29, 0, 43, 0, 31, 26, 31, 16, 45, 0, 35, 24, 45, 0, 47
Offset: 1

Views

Author

V. Raman, Nov 20 2012

Keywords

Comments

Apart from the first term, the same as A016035.
For n > 1, a(n) is also the number of numbers below n which are not coprime to n.
a(n) = 0 if n is prime.
x^(n - 1 - phi(n)) is congruent to x^(n - 1) mod n, if x is coprime to n, since x^phi(n) is congruent to 1 (mod n) if x is coprime to n.

Crossrefs

Programs

  • Magma
    [(n - 1 - (EulerPhi(n))): n in [1..100]]; // Vincenzo Librandi, Jan 26 2013
  • Mathematica
    Table[n - (EulerPhi[n] + 1), {n, 75}] (* Alonso del Arte, Nov 17 2012 *)
  • PARI
    for(n=1,100,print1(n-1-eulerphi(n)","))
    

Formula

a(n) = n - 1 - A000010(n) = A051953(n) - 1 = cototient(n) - 1. - Omar E. Pol, Nov 21 2012

A185670 Number of pairs (x,y) with 1 <= x < y <= n with at least one common factor.

Original entry on oeis.org

0, 0, 0, 1, 1, 4, 4, 7, 9, 14, 14, 21, 21, 28, 34, 41, 41, 52, 52, 63, 71, 82, 82, 97, 101, 114, 122, 137, 137, 158, 158, 173, 185, 202, 212, 235, 235, 254, 268, 291, 291, 320, 320, 343, 363, 386, 386, 417, 423, 452, 470, 497, 497, 532, 546, 577, 597, 626, 626, 669, 669, 700, 726, 757, 773, 818, 818, 853, 877, 922, 922, 969, 969, 1006, 1040
Offset: 1

Views

Author

Olivier Gérard, Feb 09 2011

Keywords

Examples

			For n=9, the a(9)=9 pairs are {(2,4),(2,6),(2,8),(3,6),(3,9),(4,6),(4,8),(6,8),(6,9)}.
		

Crossrefs

Programs

  • Haskell
    a185670 n = length [(x,y) | x <- [1..n-1], y <- [x+1..n], gcd x y > 1]
    -- Reinhard Zumkeller, Mar 02 2012
    
  • Maple
    with(numtheory): A185670:=n->n*(n-1)/2 + 1 - add( phi(i), i=1..n): seq(A185670(n), n=1..100); # Wesley Ivan Hurt, Jan 30 2017
  • Mathematica
    1 + Accumulate[ Table[n - EulerPhi[n] - 1, {n, 1, 75}]] (* Jean-François Alcover, Jan 04 2013 *)
  • PARI
    a185670(n) = sum(i=2, n, sum(j=2, i-1, gcd(i,j)>1)) \\ Hugo Pfoertner, Sep 04 2024
  • Python
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A185670(n): # based on second formula in A018805
        if n == 0:
            return 0
        c, j = 2, 2
        k1 = n//j
        while k1 > 1:
            j2 = n//k1 + 1
            c += (j2-j)*(k1*(k1-1)+1-2*A185670(k1))
            j, k1 = j2, n//j2
        return (c-j)//2 # Chai Wah Wu, Mar 24 2021
    

Formula

a(p) = a(p-1) when p is prime.
a(n)-a(n-1) = A016035(n).
a(n) = n*(n-1)/2 + 1 - Sum_{i=1..n} phi(i).
a(n) = A100613(n) - A063985(n). - Reinhard Zumkeller, Jan 21 2013

Extensions

Definition clarified by Reinhard Zumkeller, Mar 02 2012

A219839 a(n) is the number of odd integers in 2..(n-1) that have a common factor (other than 1) with n.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 2, 0, 1, 3, 0, 0, 3, 0, 2, 4, 1, 0, 4, 2, 1, 4, 2, 0, 7, 0, 0, 6, 1, 5, 6, 0, 1, 7, 4, 0, 9, 0, 2, 10, 1, 0, 8, 3, 5, 9, 2, 0, 9, 7, 4, 10, 1, 0, 14, 0, 1, 13, 0, 8, 13, 0, 2, 12, 11, 0, 12, 0, 1, 17, 2, 8, 15, 0, 8, 13, 1, 0, 18
Offset: 1

Views

Author

Lei Zhou, Nov 29 2012

Keywords

Comments

a(n) is also the number of linearly dependent diagonal/side length ratios R(n,k), in the regular n-gon. The following will explain this. In the regular n-gon inscribed in a circle the number of distinct diagonals including the side is floor(n/2). Not all of the corresponding length ratios R(n,k) = d(n,k)/d(n,1), k = 1..floor(n/2), with d(n,1) = s(n) (the length of the side), d(n,2) the length of the smallest diagonal, etc., are linearly independent because C(n,R(n,2)) = 0, where C is the minimal polynomial of R(n,2) = 2*cos(Pi/n) (see A187360) with degree delta(n) = A055034(n). Thus every ratio R(n,j), with j = delta(n)+1, ..., floor(n/2) can be expressed as a linear combination of the independent R(n,k), k=1, ..., delta(n). See the comment from Sep 21 2013 on A053121 for powers of R(n,2) (called there rho(N)). Therefore, a(n) = floor(n/2) - delta(n) is, for n>=2, the number of linearly dependent ratios R(n,k) in the regular n-gon. - Wolfdieter Lang, Sep 23 2013
From Wolfdieter Lang, Nov 23 2020: (Start)
This sequence gives the difference between the number of odd numbers in the smallest nonnegative residue system modulo n (called here RS(n)) and the smallest nonnegative restricted residue system (called here RRS(n), but RRS(1) = {1}, not {0}).
This sequence can be used to find sequence A111774 by recording the positions of the entries >= 1. See a W. Lang comment there, and also A337940, for the proof. Hence the complement of A111774, given in A174090, is given by the numbers m with a(m) = 0. (End)

Examples

			n=1: there is no odd number greater than 2 but smaller than 1-1=0, so a(1)=0.
Same for n=2,3.
n=4: 3 is the only odd number in 2..(4-1), and GCD(3,4)=1, so a(4)=0.
For any prime numbers and numbers in the form of 2^n, no odd number in 2..(n-1) has common factor with n, so a(p)=0 and a(2^n)=0, n>0.
n=6: 3,5 are odd numbers in 2..(6-1), and GCD(3,6)=3>1 and GCD(5,6)=1, so a(6)=1.
n=15: candidates are 3,5,7,9,11,13.  3, 5, and 9 have greater than 1 common factors with 15, so a(15)=3
From _Wolfdieter Lang_, Sep 23 2013: (Start)
Example n = 15 for a(n) = floor(n/2) - delta(n): 1, 3, 5, 7, 9, 11, 13 take out 1, 7, 9, 11, leaving 3, 5, 13. Therefore, a(15) = 7 - 4 = 3. See the formula above for delta.
In the regular 15-gon the 3 (= a(15)) diagonal/side ratios R(15, 5), R(15, 6) and R(15,7) can be expressed as linear combinations of the R(15,j), j=1..4.  See the n-gon comment above. (End)
From _Wolfdieter Lang_, Nov 23 2020: (Start)
n = 1: RS(1) = {0}, RRS(1) = {1}, hence a(1) = 0 - 1 = 0. Here RRS(1) is not {0}(standard) because delta(1) := 1 (the degree of minimal polynomial for 2*cos(Pi//1) = -2 which is x+2, see A187360).
n = 6: RS(6) = {0, 1, 2, 3, 4, 5} and RRS(6) = {1,5}, hence a(6) = 3 - 2 = 1, and A111774(1) = 6 = A337940(1, 1).
a(15) = 7 - 4 = 3, and A111774(6) = 15 = A337940(3, 3) = A337940(4, 1) (multiplicity 2 = A338428(6)). (End)
		

Crossrefs

Cf. A000010, A016035 (see 1st comment there), A004526, A055034, A111774, A174090, A190357, A337940, A338428.

Programs

Formula

a(n) = floor(n/2) - delta(n), with floor(n/2) = A004526 and delta(n) = A055034(n) = phi(2*n)/2, for n >= 2, with Euler's phi A000010. See the Aug 17 2011 comment on A055034. For n = 1 this would be -1, not 0, because delta(1) = 1. - Wolfdieter Lang, Sep 23 2013
Sum_{k=1..n} a(k) ~ c*n^2, where c = 1/4 - 2/Pi^2 = 0.04735763... (A190357). - Amiram Eldar, Feb 23 2025

A290599 Number of numbers from 1 to A002808(n) - 1 that are non-coprime to A002808(n).

Original entry on oeis.org

1, 3, 3, 2, 5, 7, 7, 6, 7, 11, 11, 8, 11, 15, 4, 13, 8, 15, 21, 15, 12, 17, 10, 23, 19, 14, 23, 29, 23, 20, 23, 31, 6, 29, 18, 27, 35, 14, 31, 20, 29, 43, 31, 26, 31, 16, 45, 35, 24, 45, 47, 37, 34, 39, 16, 53, 47, 26, 41, 59, 20, 43, 30, 47, 65, 18, 47, 32, 47, 22, 63, 55, 38, 59
Offset: 1

Views

Author

Wolfdieter Lang, Aug 30 2017

Keywords

Comments

a(n) is the number of positive numbers k < A002808(n) with gcd(A002808(n), k) not 1.
a(n) gives the row length of the irregular triangle A290600.

Examples

			a(4) = 2 because A002808(4) = 9, with the two non-coprime positive numbers smaller than 9, namely 3 and 6. See row n = 4 of A290600.
		

Crossrefs

Programs

  • PARI
    [k-1-eulerphi(k) | k<-[2..100], !isprime(k)] \\ Andrew Howroyd, Apr 26 2020

Formula

a(n) = A016035(A002808(n)). - Andrew Howroyd, Apr 26 2020

Extensions

Terms a(51) and beyond from Andrew Howroyd, Apr 26 2020

A308473 Sum of numbers < n which have common prime factors with n.

Original entry on oeis.org

0, 0, 0, 2, 0, 9, 0, 12, 9, 25, 0, 42, 0, 49, 45, 56, 0, 99, 0, 110, 84, 121, 0, 180, 50, 169, 108, 210, 0, 315, 0, 240, 198, 289, 175, 414, 0, 361, 273, 460, 0, 609, 0, 506, 450, 529, 0, 744, 147, 725, 459, 702, 0, 945, 385, 868, 570, 841, 0, 1290, 0, 961, 819, 992, 520
Offset: 1

Views

Author

Ilya Gutkovskiy, May 29 2019

Keywords

Crossrefs

Programs

  • Mathematica
    nmax = 65; CoefficientList[Series[-x^2 (2 - x)/(1 - x)^2 - Sum[MoebiusMu[k] k x^k/(1 - x^k)^3, {k, 2, nmax}], {x, 0, nmax}], x] // Rest
    a[n_] := Sum[If[GCD[n, k] > 1, k, 0], {k, 1, n - 1}]; Table[a[n], {n, 1, 65}]
    Join[{0}, Table[n (n - EulerPhi[n] - 1)/2, {n, 2, 65}]]
  • PARI
    a(n) = sum(k=1, n-1, if (gcd(n,k)>1, k)); \\ Michel Marcus, May 31 2019
    
  • Python
    from sympy import totient
    def A308473(n): return n*(n-totient(n)-1)>>1 if n>1 else 0 # Chai Wah Wu, Nov 06 2023

Formula

G.f.: -x^2*(2 - x)/(1 - x)^2 - Sum_{k>=2} mu(k)*k*x^k/(1 - x^k)^3.
a(n) = Sum_{k=1..n-1, gcd(n,k) > 1} k.
a(n) = n*(n - phi(n) - 1)/2 for n > 1
a(n) = n*A016035(n)/2.
a(n) = A000217(n-1) - A023896(n) for n > 1.
a(n) = A067392(n) - n for n > 1.
a(n) = 0 if n is in A008578.
Sum_{k=1..n} a(k) ~ (1/6 - 1/Pi^2)*n^3. - Vaclav Kotesovec, May 30 2019

A364934 a(n+1) = 1 + number of previous terms that share a factor > 1 with a(n); a(1) = 2.

Original entry on oeis.org

2, 2, 3, 2, 4, 5, 2, 6, 8, 8, 9, 4, 10, 12, 14, 13, 2, 14, 15, 8, 16, 17, 2, 18, 22, 20, 23, 2, 22, 23, 3, 8, 24, 29, 2, 26, 28, 28, 29, 3, 10, 32, 31, 2, 32, 33, 13, 4, 34, 36, 42, 43, 2, 38, 39, 17, 4, 40, 43, 3, 15, 21, 21, 22, 43, 4, 43, 5, 9, 19, 3, 20, 48, 58, 48, 60, 63, 28, 52, 53, 2, 51, 28
Offset: 1

Views

Author

Rok Cestnik, Aug 15 2023

Keywords

Comments

There are prominent lines that have more terms, their coefficients are approximately: 0.519, 0.329, 0.689, 0.188, 0.615, ... (see the frequency link). They seem to be distorted prime harmonic lines: 1/2, 1/3, 2/3, 1/5, 3/5, ... from A016035.
It appears limsup a(n)/n is approximately 0.83.

Examples

			[2,*]          1 term  shares a factor with 2, so a(2) = 1+1 = 2.
[2,2,*]        2 terms share  a factor with 2, so a(3) = 1+2 = 3.
[2,2,3,*]      1 term  shares a factor with 3, so a(4) = 1+1 = 2.
[2,2,3,2,*]    3 terms share  a factor with 2, so a(5) = 1+3 = 4.
[2,2,3,2,4,*]  4 terms share  a factor with 4, so a(6) = 1+4 = 5.
		

Crossrefs

Programs

A366192 Pairs (i, j) of noncoprime positive integers sorted first by i + j then by i.

Original entry on oeis.org

2, 2, 2, 4, 3, 3, 4, 2, 2, 6, 4, 4, 6, 2, 3, 6, 6, 3, 2, 8, 4, 6, 5, 5, 6, 4, 8, 2, 2, 10, 3, 9, 4, 8, 6, 6, 8, 4, 9, 3, 10, 2, 2, 12, 4, 10, 6, 8, 7, 7, 8, 6, 10, 4, 12, 2, 3, 12, 5, 10, 6, 9, 9, 6, 10, 5, 12, 3, 2, 14, 4, 12, 6, 10, 8, 8, 10, 6, 12, 4, 14, 2
Offset: 1

Views

Author

Peter Luschny, Oct 10 2023

Keywords

Comments

The rows of A290600 interleaved term by term with the reversed rows of A290600. - Peter Munn, Jan 28 2024

Examples

			The first few pairs are, seen as an irregular triangle (where rows with a prime index are empty (and are therefore missing)):
  [2,  2],
  [2,  4], [3,  3], [4, 2],
  [2,  6], [4,  4], [6, 2],
  [3,  6], [6,  3],
  [2,  8], [4,  6], [5, 5], [6, 4], [ 8, 2],
  [2, 10], [3,  9], [4, 8], [6, 6], [ 8, 4], [ 9, 3], [10, 2],
  [2, 12], [4, 10], [6, 8], [7, 7], [ 8, 6], [10, 4], [12, 2],
  [3, 12], [5, 10], [6, 9], [9, 6], [10, 5], [12, 3],
  ...
There are A016035(n) pairs in row n.
		

Crossrefs

Cf. A016035, A290600 (first bisection), A352911 (complement).

Programs

  • Maple
    aList := proc(upto) local F, P, n, t, count;
    P := NULL; count := 0:
    for n from 2 while count < upto do
        F := select(t -> igcd(t, n - t) <> 1, [$1..n-1]);
        P := P, seq([t, n - t], t = F);
        count := count + nops([F]) od:
    ListTools:-Flatten([P]) end:
    aList(16);
  • Mathematica
    A366192row[n_]:=Select[Array[{#,n-#}&,n-1],!CoprimeQ[First[#],Last[#]]&];
    Array[A366192row,20,2] (* Paolo Xausa, Nov 28 2023 *)
  • Python
    from math import gcd
    from itertools import chain, count, islice
    def A366192_gen(): # generator of terms
        return chain.from_iterable((i,n-i) for n in count(2) for i in range(1,n) if gcd(i,n-i)>1)
    A366192_list = list(islice(A366192_gen(),30)) # Chai Wah Wu, Oct 10 2023
Showing 1-8 of 8 results.