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.

A073811 Number of common divisors of n and phi(n).

Original entry on oeis.org

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

Views

Author

Labos Elemer, Aug 13 2002

Keywords

Comments

Where records occur: 1, 4, 8, 16, 32, 36, 72, 108, 144, 216, 432, 648, 864, ... - David A. Corneth, Oct 21 2017

Examples

			For n = 24: phi(n) = 8, Intersection[{1,2,3,4,6,8,12,24},{1,2,4,8}] = {1,2,4,8}, so a(24) = 4.
		

Crossrefs

Programs

  • Mathematica
    g1[x_] := Divisors[x] g2[x_] := Divisors[EulerPhi[x]] ncd[x_] := Length[Intersection[g1[x], g2[x]]] Table[ncd[w], {w, 1, 128}]
    Table[Length[Intersection[Divisors[n],Divisors[EulerPhi[n]]]],{n,110}] (* Harvey P. Dale, Oct 03 2013 *)
    a[n_] := DivisorSigma[0, GCD[n, EulerPhi[n]]]; Array[a, 100] (* Amiram Eldar, Jul 01 2022 *)
  • PARI
    A073811(n) = sumdiv(eulerphi(n),d,!(n%d)); \\ Antti Karttunen, Oct 21 2017
    
  • PARI
    a(n) = numdiv(gcd(eulerphi(n), n)) \\ David A. Corneth, Oct 21 2017
    
  • Scheme
    ;; Implemented literally (naively) after the description. Either:
    (define (A073811 n) (length (filter (lambda (d) (zero? (modulo n d))) (divisors (A000010 n)))))
    ;; Or:
    (define (A073811 n) (let ((phn (A000010 n))) (length (filter (lambda (d) (zero? (modulo phn d))) (divisors n)))))
    (define (divisors n) (cons 1 (proper-divisors n))) ;; This can be also memoized with definec.
    (define (proper-divisors n) (let loop ((k n) (divs (list))) (cond ((= 1 k) divs) ((zero? (modulo n k)) (loop (- k 1) (cons k divs))) (else (loop (- k 1) divs)))))
    ;; Antti Karttunen, Oct 21 2017

Formula

a(n) = Card[Intersection[D[n], D[A000010(n)]]].
a(n) = Sum_{d|n, d|A000010(n)} 1. - Antti Karttunen, Oct 21 2017
a(n) = A000005(A009195(n)). - Antti Karttunen, Oct 21 2017, after David A. Corneth's PARI-program.

A073812 Number of common divisors of sigma(n) and phi(n).

Original entry on oeis.org

1, 1, 2, 1, 2, 2, 2, 1, 1, 2, 2, 3, 2, 4, 4, 1, 2, 2, 2, 2, 3, 2, 2, 3, 1, 4, 2, 3, 2, 4, 2, 1, 3, 2, 8, 1, 2, 4, 4, 2, 2, 6, 2, 3, 4, 2, 2, 3, 2, 1, 4, 2, 2, 4, 4, 8, 3, 2, 2, 4, 2, 4, 3, 1, 6, 3, 2, 2, 3, 8, 2, 2, 2, 4, 3, 3, 6, 8, 2, 2, 1, 2, 2, 4, 3, 4, 4, 6, 2, 4, 4, 3, 3, 2, 8, 3, 2, 2, 6, 1, 2, 4, 2, 4
Offset: 1

Views

Author

Labos Elemer, Aug 13 2002

Keywords

Examples

			n=36: sigma(36)=91; phi(36)=12; Intersection[{1,7,13,91},{1,2,3,4,6,12}]={1}, so a(36)=1.
		

Crossrefs

Programs

  • Mathematica
    g1[x_] := Divisors[DivisorSigma[1, x]] g2[x_] := Divisors[EulerPhi[x]] ncd[x_] := Length[Intersection[g1[x], g2[x]]] Table[ncd[w], {w, 1, 128}]
    a[n_] := DivisorSigma[0, GCD[DivisorSigma[1, n], EulerPhi[n]]]; Array[a, 100] (* Amiram Eldar, Oct 18 2019 *)

Formula

a(n) = Card[Intersection[D[A000203(n)], D[A000010(n)]]].
Showing 1-2 of 2 results.