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-10 of 21 results. Next

A241664 Number of iterations of A058026 needed to reach either 0 or 1.

Original entry on oeis.org

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

Views

Author

Colin Defant, Apr 26 2014

Keywords

Comments

I conjecture that, for n>3 and n odd, we have a(n)>=log((49/15)n)/log(7).

Examples

			A058026(7)=5, A058026(5)=3, A058026(3)=1. As it takes 3 iterations to reach 1, a(7)=3.
		

Programs

  • Haskell
    a241664 n = fst $ until ((<= 1) . snd)
                            (\(u, v) -> (u + 1, a058026 v)) (0, n)
    -- Reinhard Zumkeller, May 10 2014

Extensions

a(1) corrected by Reinhard Zumkeller, May 10 2014

A241667 Sum of the iterates of A058026 up to and including either 0 or 1.

Original entry on oeis.org

0, 0, 1, 0, 4, 0, 9, 0, 4, 0, 13, 0, 24, 0, 4, 0, 19, 0, 36, 0, 9, 0, 30, 0, 19, 0, 13, 0, 40, 0, 69, 0, 13, 0, 19, 0, 54, 0, 24, 0, 63, 0, 104, 0, 13, 0, 58, 0, 54, 0, 19, 0, 70, 0, 40, 0, 36, 0, 93, 0, 152, 0, 19, 0, 46, 0, 111, 0, 30, 0, 99, 0, 170, 0, 19
Offset: 1

Views

Author

Colin Defant, Apr 26 2014

Keywords

Comments

It is interesting to note that a(37147) = 37147.
Also a(53290831) = 53290831. - Michel Marcus, Jun 18 2015

Examples

			A058026(7)=5, A058026(5)=3, A058026(3)=1, so a(7)=5+3+1=9. A058026(4)=0, so a(4)=0.
		

Programs

  • Mathematica
    L[n_, m_] :=
    If[Min[Select[Divisors[n], PrimeQ]] <= m, 0,
      n*Times @@ (1 - m/(Select[Divisors[n], PrimeQ]))]
    a[0] := 0
    a[3] := 1
    a[n_] := L[n, 2] + a[L[n, 2]]
    Table[a[i], {i, 2, 30}]
  • PARI
    a058026(n) = sumdiv(n, d, n/d*moebius(d)*numdiv(d));
    a(n) = {s = 0; itn = n; while((itn) && (itn != 1), vb = a058026(itn); s += vb; itn = vb); s;} \\ Michel Marcus, May 21 2014

A330902 Odd numbers k such that s(k) = s(k+2), where s(k) is Schemmel's totient function of order 2 (A058026).

Original entry on oeis.org

1, 9359, 23933, 97405, 131493, 304589, 529205, 6005613, 6024473, 6057257, 7636517, 9566549, 11481581, 25143017, 25439117, 28542745, 40473869, 57712193, 58761197, 69502169, 77085497, 78481397, 81127109, 95223857, 99815303, 104092517, 112282481, 119954477, 130052613
Offset: 1

Views

Author

Amiram Eldar, May 01 2020

Keywords

Comments

Since s(k) = 0 for all even numbers k, they are trivial solutions of the equation s(k) = s(k+2) and therefore they were excluded from this sequence.
Analogous to A001494 since Schemmel's totient functions are a generalization of the Euler totient function (A000010).

Examples

			1 is a term since s(1) = s(3) = 1.
9359 is a term since s(9359) = s(9361) = 6615.
		

References

  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, Chapter 3, p. 276.

Crossrefs

Programs

  • Mathematica
    f[p_, e_] := (p-2) * p^(e-1); s[1]=1; s[n_] := Times @@ (f @@@ FactorInteger[n]); seq={}; s1 = 1; Do[s2 = s[n]; If[s1 == s2, AppendTo[seq, n-2]]; s1 = s2, {n, 3, 10^6, 2}]; seq

A040001 1 followed by {1, 2} repeated.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
Offset: 0

Views

Author

Keywords

Comments

Continued fraction for sqrt(3).
Also coefficient of the highest power of q in the expansion of the polynomial nu(n) defined by: nu(0)=1, nu(1)=b and for n>=2, nu(n)=b*nu(n-1)+lambda*(n-1)_q*nu(n-2) with (b,lambda)=(1,1), where (n)_q=(1+q+...+q^(n-1)) and q is a root of unity. - Y. Kelly Itakura (yitkr(AT)mta.ca), Aug 21 2002
nu(0)=1 nu(1)=1; nu(2)=2; nu(3)=3+q; nu(4)=5+3q+2q^2; nu(5)=8+7q+6q^2+4q^3+q^4; nu(6)=13+15q+16q^2+14q^3+11q^4+5q^5+2q^6.
From Jaroslav Krizek, May 28 2010: (Start)
a(n) = denominators of arithmetic means of the first n positive integers for n >= 1.
See A026741(n+1) or A145051(n) - denominators of arithmetic means of the first n positive integers. (End)
From R. J. Mathar, Feb 16 2011: (Start)
This is a prototype of multiplicative sequences defined by a(p^e)=1 for odd primes p, and a(2^e)=c with some constant c, here c=2. They have Dirichlet generating functions (1+(c-1)/2^s)*zeta(s).
Examples are A153284, A176040 (c=3), A040005 (c=4), A021070, A176260 (c=5), A040011, A176355 (c=6), A176415 (c=7), A040019, A021059 (c=8), A040029 (c=10), A040041 (c=12). (End)
a(n) = p(-1) where p(x) is the unique degree-n polynomial such that p(k) = A000325(k) for k = 0, 1, ..., n. - Michael Somos, May 12 2012
For n > 0: denominators of row sums of the triangular enumeration of rational numbers A226314(n,k) / A054531(n,k), 1 <= k <= n; see A226555 for numerators. - Reinhard Zumkeller, Jun 10 2013
From Jianing Song, Nov 01 2022: (Start)
For n > 0, a(n) is the minimal gap of distinct numbers coprime to n. Proof: denote the minimal gap by b(n). For odd n we have A058026(n) > 0, hence b(n) = 1. For even n, since 1 and -1 are both coprime to n we have b(n) <= 2, and that b(n) >= 2 is obvious.
The maximal gap is given by A048669. (End)

Examples

			1.732050807568877293527446341... = 1 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + ...))))
G.f. = 1 + x + 2*x^2 + x^3 + 2*x^4 + x^5 + 2*x^6 + x^7 + 2*x^8 + x^9 + ...
		

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See p. 186.
  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §4.4 Powers and Roots, p. 144.
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 276.

Crossrefs

Cf. A000034, A002194, A133566, A083329 (binomial Transf).
Apart from a(0) the same as A134451.

Programs

  • Haskell
    a040001 0 = 1; a040001 n = 2 - mod n 2
    a040001_list = 1 : cycle [1, 2]  -- Reinhard Zumkeller, Apr 16 2015
  • Maple
    Digits := 100: convert(evalf(sqrt(N)),confrac,90,'cvgts'):
  • Mathematica
    ContinuedFraction[Sqrt[3],300] (* Vladimir Joseph Stephan Orlovsky, Mar 04 2011 *)
    PadRight[{1},120,{2,1}] (* Harvey P. Dale, Nov 26 2015 *)
  • PARI
    {a(n) = 2 - (n==0) - (n%2)} /* Michael Somos, Jun 11 2003 */
    
  • PARI
    { allocatemem(932245000); default(realprecision, 12000); x=contfrac(sqrt(3)); for (n=0, 20000, write("b040001.txt", n, " ", x[n+1])); } \\ Harry J. Smith, Jun 01 2009
    

Formula

Multiplicative with a(p^e) = 2 if p even; 1 if p odd. - David W. Wilson, Aug 01 2001
G.f.: (1 + x + x^2) / (1 - x^2). E.g.f.: (3*exp(x)-2*exp(0)+exp(-x))/2. - Paul Barry, Apr 27 2003
a(n) = (3-2*0^n +(-1)^n)/2. a(-n)=a(n). a(2n+1)=1, a(2n)=2, n nonzero.
a(n) = sum{k=0..n, F(n-k+1)*(-2+(1+(-1)^k)/2+C(2, k)+0^k)}. - Paul Barry, Jun 22 2007
Row sums of triangle A133566. - Gary W. Adamson, Sep 16 2007
Euler transform of length 3 sequence [ 1, 1, -1]. - Michael Somos, Aug 04 2009
Moebius transform is length 2 sequence [ 1, 1]. - Michael Somos, Aug 04 2009
a(n) = sign(n) + ((n+1) mod 2) = 1 + sign(n) - (n mod 2). - Wesley Ivan Hurt, Dec 13 2013

A065474 Decimal expansion of Product_{p prime} (1 - 2/p^2).

Original entry on oeis.org

3, 2, 2, 6, 3, 4, 0, 9, 8, 9, 3, 9, 2, 4, 4, 6, 7, 0, 5, 7, 9, 5, 3, 1, 6, 9, 2, 5, 4, 8, 2, 3, 7, 0, 6, 6, 5, 7, 0, 9, 5, 0, 5, 7, 9, 6, 6, 5, 8, 3, 2, 7, 0, 9, 9, 6, 1, 8, 1, 1, 2, 5, 2, 4, 5, 3, 2, 5, 0, 0, 6, 3, 4, 8, 6, 2, 4, 4, 6, 0, 9, 8, 8, 4, 5, 2, 3, 4, 8, 1, 5, 6, 8, 5, 6, 3, 7, 5, 5, 2, 1, 7, 7, 2, 7, 3
Offset: 0

Views

Author

N. J. A. Sloane, Nov 19 2001

Keywords

Comments

Density of A007674, squarefree n such that n + 1 is squarefree. - Charles R Greathouse IV, Aug 10 2011
Product_{k>=1} (1 - 2/k^2) = sin(sqrt(2)*Pi) / (sqrt(2)*Pi). - Vaclav Kotesovec, May 23 2020
The asymptotic probability that, for two integers k and m, 0 < k <= m, we have gcd(k*(k+1), m) = 1 (when k and m are chosen at random in the range 1..n and n->oo) (Tóth and Sándor, 1989). - Amiram Eldar, Apr 29 2023

Examples

			0.322634098939244670579531692548...
		

References

  • Henri Cohen, Number Theory, Volume II: Analytic and Modern Tools, GTM Vol. 240, Springer, 2007; see pp. 208-209.

Crossrefs

Programs

  • Mathematica
    $MaxExtraPrecision = 800; digits = 98; terms = 800; P[n_] := PrimeZetaP[n]; LR = Join[{0, 0}, LinearRecurrence[{0, 2}, {-4, 0}, terms + 10]]; r[n_Integer] := LR[[n]]; Exp[NSum[r[n]*P[n - 1]/(n - 1), {n, 3, terms}, NSumTerms -> terms, WorkingPrecision -> digits + 10]] // RealDigits[#, 10, digits]& // First (* Jean-François Alcover, Apr 18 2016 *)
  • PARI
    prodeulerrat(1 - 2/p^2) \\ Amiram Eldar, Mar 16 2021

Extensions

Edited by Dean Hickerson, Sep 10 2002
More digits from Vaclav Kotesovec, Dec 18 2019

A134451 Ternary digital root of n.

Original entry on oeis.org

0, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2
Offset: 0

Views

Author

Reinhard Zumkeller, Oct 27 2007

Keywords

Comments

Continued fraction expansion of sqrt(3) - 1. - N. J. A. Sloane, Dec 17 2007. Cf. A040001, A048878/A002530.
Minimum number of terms required to express n as a sum of odd numbers.
Shadow transform of even numbers A005843. - Michel Marcus, Jun 06 2013
From Jianing Song, Nov 01 2022: (Start)
For n > 0, a(n) is the minimal gap of distinct numbers coprime to n. Proof: denote the minimal gap by b(n). For odd n we have A058026(n) > 0, hence b(n) = 1. For even n, since 1 and -1 are both coprime to n we have b(n) <= 2, and that b(n) >= 2 is obvious.
The maximal gap is given by A048669. (End)

Examples

			n=42: A007089(42) = '1120', A053735(42) = 1+1+2+0 = 4,
A007089(4)='11', A053735(4)=1+1=2: therefore a(42) = 2.
0.732050807568877293527446341... = 0 + 1/(1 + 1/(2 + 1/(1 + 1/(2 + ...)))). - _Harry J. Smith_, May 31 2009
		

Crossrefs

Cf. A000010, A055034, A134452, A160390 (decimal expansion).
Apart from a(0) the same as A040001.
Related base-3 sequences: A053735, A134451, A230641, A230642, A230643, A230853, A230854, A230855, A230856, A230639, A230640, A010063 (trajectory of 1).

Programs

Formula

a(n) = n if n <= 2, otherwise a(A053735(n)).
a(A005408(n)) = 1; a(A005843(n)) = 2 for n>0;
a(n) = 0 if n=0, otherwise A000034(n-1).
a(n) = ((n+1) mod 2) + 2*sign(n) - 1. - Wesley Ivan Hurt, Dec 06 2013
Multiplicative with a(2^e) = 2, a(p^e) = 1 for odd prime p. - Andrew Howroyd, Aug 06 2018
a(0) = A055034(1) / A000010(1), a(n) = A000010(n+1) / A055034(n+1), n>1. - Torlach Rush, Oct 29 2019
Dirichlet g.f.: zeta(s)*(1+1/2^s). - Amiram Eldar, Jan 01 2023

A123565 a(n) is the number of positive integers k which are <= n and where k, k-1 and k+1 are each coprime to n.

Original entry on oeis.org

1, 0, 0, 0, 2, 0, 4, 0, 0, 0, 8, 0, 10, 0, 0, 0, 14, 0, 16, 0, 0, 0, 20, 0, 10, 0, 0, 0, 26, 0, 28, 0, 0, 0, 8, 0, 34, 0, 0, 0, 38, 0, 40, 0, 0, 0, 44, 0, 28, 0, 0, 0, 50, 0, 16, 0, 0, 0, 56, 0, 58, 0, 0, 0, 20, 0, 64, 0, 0, 0, 68, 0, 70, 0, 0, 0, 32, 0, 76, 0, 0, 0, 80, 0, 28, 0, 0, 0, 86, 0, 40, 0, 0
Offset: 1

Views

Author

Leroy Quet, Nov 12 2006

Keywords

Comments

a(p) = p-3 for any odd prime p. a(2n) = a(3n) = 0.
a(n) > 0 if and only if n is coprime to 6. - Chai Wah Wu, Aug 26 2016
Multiplicative by the Chinese remainder theorem. - Andrew Howroyd, Aug 07 2018
From Eduard I. Vatutin, Nov 03 2020: (Start)
a(n) is the number of cyclic diagonal Latin squares of order n with the first row in order. Every cyclic diagonal Latin square is a cyclic Latin square, so a(n) <= A000010(n). Every cyclic diagonal Latin square is pandiagonal, but the converse is not true. For example, for order n=13 there is a square
7 1 0 3 6 5 12 2 8 9 10 11 4
2 3 4 10 0 7 6 9 12 11 5 8 1
4 11 1 7 8 9 10 3 6 0 12 2 5
6 5 8 11 10 4 7 0 1 2 3 9 12
8 9 2 5 12 11 1 4 3 10 0 6 7
3 6 12 0 1 2 8 11 5 4 7 10 9
10 0 3 2 9 12 5 6 7 8 1 4 11
1 7 10 4 3 6 9 8 2 5 11 12 0
11 4 5 6 7 0 3 10 9 12 2 1 8
5 8 7 1 4 10 11 12 0 6 9 3 2
12 2 9 8 11 1 0 7 10 3 4 5 6
9 10 11 12 5 8 2 1 4 7 6 0 3
0 12 6 9 2 3 4 5 11 1 8 7 10
that is pandiagonal but not cyclic (Dabbaghian and Wu). (End)
Schemmel's totient function of order 3 (Schemmel, 1869; Sándor and Crstici, 2004). - Amiram Eldar, Nov 22 2020
a(p) is a lower bound for cardinality of clique of MODLS for all odd prime orders p: a(p) <= A328873(p). - Eduard I. Vatutin, Apr 02 2021
Also number of solutions for n-queens problem on toroidal chessboard (see A051906, A007705 or A370672), given by knight with (dx,dy) movement parameters starting from top left corner (more generally: from one cell fixed for all solutions). - Eduard I. Vatutin, Mar 13 2024

Examples

			The positive integers which are both coprime to 25 and are <= 25 are 1,2,3,4,6,7,8,9,11,12,13,14,16,17,18,19,21,22,23,24. Of these integers there are 10 integers k where (k-1) and (k+1) are also coprime to 25. These integers k are 2,3,7,8,12,13,17,18,22,23. So a(25) = 10.
Example of a cyclic diagonal Latin square of order 5:
  0 1 2 3 4
  2 3 4 0 1
  4 0 1 2 3
  1 2 3 4 0
  3 4 0 1 2
Example of a cyclic diagonal Latin square of order 7:
  0 1 2 3 4 5 6
  2 3 4 5 6 0 1
  4 5 6 0 1 2 3
  6 0 1 2 3 4 5
  1 2 3 4 5 6 0
  3 4 5 6 0 1 2
  5 6 0 1 2 3 4
From _Eduard I. Vatutin_, Mar 13 2024: (Start)
Example of a(5)=2 solutions for n-queens problem on toroidal chessboard, given by knight with (+1,+2) and (+1,+3) movement parameters starting from top left corner:
.
+-----------+ +-----------+
| Q . . . . | | Q . . . . |
| . . Q . . | | . . . Q . |
| . . . . Q | | . Q . . . |
| . Q . . . | | . . . . Q |
| . . . Q . | | . . Q . . |
+-----------+ +-----------+
.
Example of a(7)=4 solutions for n-queens problem on toroidal chessboard, given by knight with (+1,+2), (+1,+3), (+1,+4), (+1,+5) movement parameters starting from top left corner:
.
+---------------+ +---------------+ +---------------+ +---------------+
| Q . . . . . . | | Q . . . . . . | | Q . . . . . . | | Q . . . . . . |
| . . Q . . . . | | . . . Q . . . | | . . . . Q . . | | . . . . . Q . |
| . . . . Q . . | | . . . . . . Q | | . Q . . . . . | | . . . Q . . . |
| . . . . . . Q | | . . Q . . . . | | . . . . . Q . | | . Q . . . . . |
| . Q . . . . . | | . . . . . Q . | | . . Q . . . . | | . . . . . . Q |
| . . . Q . . . | | . Q . . . . . | | . . . . . . Q | | . . . . Q . . |
| . . . . . Q . | | . . . . Q . . | | . . . Q . . . | | . . Q . . . . |
+---------------+ +---------------+ +---------------+ +---------------+
(End)
		

References

  • József Sándor and Borislav Crstici, Handbook of Number theory II, Kluwer Academic Publishers, 2004, chapter 3, p. 276.

Crossrefs

Programs

  • Maple
    f:= proc(n) local V,R;
      V:= map(igcd,[$1..n],n);
      R:= V[1..n-2] + V[2..n-1] + V[3..n];
      numboccur(3,R);
    end proc:
    f(1):= 1:
    map(f, [$1..100]); # Robert Israel, Mar 15 2024
  • Mathematica
    f[n_] := Length[Select[Range[n],GCD[ #, n] == 1 && GCD[ # - 1, n] == 1 && GCD[ # + 1, n] == 1 &]];Table[f[n], {n, 100}] (* Ray Chandler, Nov 19 2006 *)
    Join[{1},Table[Count[Boole[Partition[CoprimeQ[Range[n],n],3,1]],{1,1,1}],{n,2,100}]] (* Harvey P. Dale, Apr 09 2017 *)
    f[2, e_] := 0; f[p_, e_] := (p - 3)*p^(e - 1); a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Nov 22 2020 *)
  • PARI
    a(n)=if(gcd(n,6)>1, return(0)); sum(k=1,n,gcd(k^3-k,n)==1) \\ Charles R Greathouse IV, Aug 26 2016

Formula

Multiplicative with a(2^e) = 0 and a(p^e) = (p-3)*p^(e-1) for odd primes p. - Amiram Eldar, Nov 22 2020
a(2*n+1) = A338562(n) / (2*n+1)!. - Eduard I. Vatutin, Apr 02 2021
Sum_{k=1..n} a(k) ~ c * n^2, where c = Product_{p prime} (1 - 3/p^2) = 0.125486... (A206256). - Amiram Eldar, Nov 18 2022
a(n) = A370672((n-1)/2) / n. - Eduard I. Vatutin, Mar 13 2024

Extensions

Extended by Ray Chandler, Nov 19 2006

A002472 Number of pairs x,y such that y-x=2, (x,n)=1, (y,n)=1 and 1 <= x <= n.

Original entry on oeis.org

1, 1, 1, 2, 3, 1, 5, 4, 3, 3, 9, 2, 11, 5, 3, 8, 15, 3, 17, 6, 5, 9, 21, 4, 15, 11, 9, 10, 27, 3, 29, 16, 9, 15, 15, 6, 35, 17, 11, 12, 39, 5, 41, 18, 9, 21, 45, 8, 35, 15, 15, 22, 51, 9, 27, 20, 17, 27, 57, 6, 59, 29, 15, 32, 33, 9, 65, 30, 21, 15, 69, 12, 71, 35, 15, 34, 45, 11, 77, 24, 27
Offset: 1

Views

Author

Keywords

Comments

This is the function phi(n, 2) defined in Alder. - Michel Marcus, Nov 14 2017

Examples

			For n = 4, the condition gcd(x,4) = gcd(x+2,4) = 1 is satisfied by exactly two positive integers x not exceeding n, namely, by x = 1 and x = 3. Therefore a(4) = 2.
		

References

  • V. A. Golubev, Sur certaines fonctions multiplicatives et le problème des jumeaux. Mathesis 67 (1958), 11-20.
  • V. A. Golubev, Nombres de Mersenne et caractères du nombre 2. Mathesis 67 (1958), 257-262.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000010 (phi(n,0)), A058026 (phi(n,1)), A065474.
Similar generalizations of Euler's totient for prime k-tuples: this sequence (k=2), A319534 (k=3), A319516 (k=4), A321029 (k=5), A321030 (k=6).

Programs

  • Haskell
    a002472 n = length [x | x <- [1..n], gcd n x == 1, gcd n (x + 2) == 1]
    -- Reinhard Zumkeller, Mar 23 2012
  • Maple
    with(numtheory): seq(add(mobius(d)*phi(2*n)/phi(2*d), d in divisors(n)), n=1..100); # Ridouane Oudra, Aug 20 2024
  • Mathematica
    a[n_] := If[ Head[ r=Reduce[ GCD[x, n] == 1 && GCD[x+2, n] == 1 && 1 <= x <= n, x, Integers]] === Or, Length[r], 1]; Table[a[n], {n, 1, 81}] (* Jean-François Alcover, Nov 22 2011 *)
    (* Second program (5 times faster): *)
    a[n_] := Sum[Boole[GCD[n, x] == 1 && GCD[n, x+2] == 1], {x, 1, n}];
    Array[a, 81] (* Jean-François Alcover, Jun 19 2018, after Michel Marcus *)
    f[p_, e_] := If[p == 2, p^(e-1), (p-2)*p^(e-1)]; a[1] = 1; a[n_] := Times @@ f @@@ FactorInteger[n]; Array[a, 100] (* Amiram Eldar, Jan 22 2020 *)
  • PARI
    a(n)=my(k=valuation(n,2),f=factor(n>>k));prod(i=1,#f[,1],(f[i,1]-2)*f[i,1]^(f[i,2]-1))<Charles R Greathouse IV, Nov 22 2011
    
  • PARI
    a(n) = sum(x=1, n, (gcd(n,x) == 1) && (gcd(n, x+2) == 1)); \\ Michel Marcus, Nov 14 2017
    

Formula

Multiplicative with a(p^e) = p^(e-1) if p = 2; (p-2)*p^(e-1) if p > 2. - David W. Wilson, Aug 01 2001
a(n) = Sum_{k=1..n} [GCD(2*n-k,n) * GCD(k+2,n) = 1], where [ ] is the Iverson bracket. - Wesley Ivan Hurt, Sep 29 2021
Sum_{k=1..n} a(k) ~ c * n^2, where c = (3/4) * Product_{p prime} (1 - 2/p^2) = (3/4) * A065474 = 0.2419755742... . - Amiram Eldar, Oct 23 2022
From Ridouane Oudra, Aug 20 2024: (Start)
a(n) = phi(2*n) * Sum_{d|n} mu(d)/phi(2*d).
a(n) = - phi(n) * Sum_{d|n} mu(2*d)/phi(d).
a(n) = A160467(n)*A058026(A000265(n)).
a(2*n+1) = A070554(n).
a(2^m*(2*n+1)) = 2^(m-1)*A070554(n), with m>0. (End)

Extensions

More terms from David W. Wilson

A289460 Number of units u in Z/nZ such that Phi(3,u) is a unit, where Phi is the cyclotomic polynomial.

Original entry on oeis.org

1, 1, 1, 2, 4, 1, 4, 4, 3, 4, 10, 2, 10, 4, 4, 8, 16, 3, 16, 8, 4, 10, 22, 4, 20, 10, 9, 8, 28, 4, 28, 16, 10, 16, 16, 6, 34, 16, 10, 16, 40, 4, 40, 20, 12, 22, 46, 8, 28, 20, 16, 20, 52, 9, 40, 16, 16, 28, 58, 8, 58, 28, 12, 32, 40, 10, 64, 32, 22, 16, 70, 12
Offset: 1

Views

Author

Keywords

Comments

The number of units u in Z/nZ such that Phi(1,u) or Phi(2,u) is a unit is given by A058026.

Crossrefs

Cf. A058026.

Programs

  • Maple
    m:=3; T:=[]: for n from 2 to 1000 do S:={}: for a from 0 to n-1 do if gcd(a,n)=1 and gcd(cyclotomic(m,a),n)=1 then S:={op(S),a}: fi: od: T:=[op(T),nops(S)]: od: print(m,T):
  • Mathematica
    Table[Count[Map[Cyclotomic[3, #] &, Select[Range@ n, CoprimeQ[#, n] &]], u_ /; CoprimeQ[u, n]], {n, 72}] (* Michael De Vlieger, Jul 11 2017 *)
  • PARI
    g(n)=sum(k=0,n-1, gcd(k,n)==1 && gcd(polcyclo(3,k),n)==1)
    a(n)=my(f=factor(n)); prod(i=1,#f~, g(f[i,1]^f[i,2])) \\ Charles R Greathouse IV, Jul 06 2017

A241663 Number of positive integers k less than or equal to n such that gcd(k,n) = gcd(k+1,n) = gcd(k+2,n) = gcd(k+3,n) = 1.

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 3, 0, 0, 0, 7, 0, 9, 0, 0, 0, 13, 0, 15, 0, 0, 0, 19, 0, 5, 0, 0, 0, 25, 0, 27, 0, 0, 0, 3, 0, 33, 0, 0, 0, 37, 0, 39, 0, 0, 0, 43, 0, 21, 0, 0, 0, 49, 0, 7, 0, 0, 0, 55, 0, 57, 0, 0, 0, 9, 0, 63, 0, 0, 0, 67, 0, 69, 0, 0, 0, 21, 0, 75, 0, 0
Offset: 1

Views

Author

Colin Defant, Apr 26 2014

Keywords

Comments

a(n) is the 4th Schemmel totient function.

Examples

			a(35) = a(5)*a(7) = 1*3 = 3.
		

Crossrefs

Programs

  • Mathematica
    Table[Boole[n == 1] + Count[Partition[Range@ n, 4, 1], _?(AllTrue[#, CoprimeQ[n, #] &] &)], {n, 81}] (* or *)
    Array[If[# == 1, 1, Apply[Times, FactorInteger[#] /. {p_, e_} /; p > 1 :> If[p > 3, (p - 4) p^(e - 1), 0]]] &, 81] (* Michael De Vlieger, Nov 05 2017 *)
  • PARI
    a(n) = {my(f = factor(n)); prod(i=1, #f~, if ((f[i, 1] == 2) || (f[i, 1] == 3), 0, f[i, 1]^(f[i, 2]-1)*(f[i, 1]-4)));} \\ Michel Marcus, May 01 2014
    
  • Scheme
    ;; After the given multiplicative formula. Uses memoization-macro definec:
    (definec (A241663 n) (if (= 1 n) n (let ((p (A020639 n))) (if (<= p 3) 0 (* (- p 4) (expt p (- (A067029 n) 1)) (A241663 (A028234 n))))))) ;; Antti Karttunen, Nov 05 2017

Formula

Multiplicative with a(p^e) = p^(e-1)*(p-4) for p > 3. a(2^e) = a(3^e) = 0 for e > 0.
Sum_{k=1..n} a(k) ~ c * n^2, where c = (1/6) * Product_{p prime >= 5} (1 - 4/p^2) = 0.11357982182683545733... . - Amiram Eldar, Oct 13 2022
Showing 1-10 of 21 results. Next