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.

A285328 a(n) = 1 if n is squarefree (A005117), otherwise a(n) = Max {m < n | same prime factors as n, ignoring multiplicity}.

Original entry on oeis.org

1, 1, 1, 2, 1, 1, 1, 4, 3, 1, 1, 6, 1, 1, 1, 8, 1, 12, 1, 10, 1, 1, 1, 18, 5, 1, 9, 14, 1, 1, 1, 16, 1, 1, 1, 24, 1, 1, 1, 20, 1, 1, 1, 22, 15, 1, 1, 36, 7, 40, 1, 26, 1, 48, 1, 28, 1, 1, 1, 30, 1, 1, 21, 32, 1, 1, 1, 34, 1, 1, 1, 54, 1, 1, 45, 38, 1, 1, 1, 50, 27, 1, 1, 42, 1, 1, 1, 44, 1, 60, 1, 46, 1, 1, 1, 72, 1, 56, 33, 80, 1, 1, 1, 52, 1, 1, 1, 96
Offset: 1

Views

Author

Antti Karttunen, Apr 17 2017

Keywords

Examples

			From _Michael De Vlieger_, Dec 31 2018: (Start)
a(1) = 1 since 1 is squarefree.
a(2) = 1 since 2 is squarefree.
a(4) = 2 since 4 is not squarefree and 2 is the largest number less than 4 that has all the distinct prime divisors that 4 has.
a(6) = 1 since 6 is squarefree.
a(12) = 6 since 12 is not squarefree and 6 is the largest number less than 12 that has all the distinct prime divisors that 12 has. (6 is also the squarefree root of 12).
a(16) = 8 since 16 is not squarefree and 8 is the largest number less than 16 that has all the distinct prime divisors that 16 has.
a(18) = 12 since 18 is not squarefree and 12 is the largest number less than 18 that has all the distinct prime divisors that 18 has.
(End)
		

Crossrefs

A left inverse of A065642.
Cf. also A079277.

Programs

  • Mathematica
    Table[With[{r = DivisorSum[n, EulerPhi[#] Abs@ MoebiusMu[#] &]}, If[MoebiusMu@ n != 0, 1, SelectFirst[Range[n - 2, 2, -1], DivisorSum[#, EulerPhi[#] Abs@ MoebiusMu[#] &] == r &]]], {n, 108}] (* Michael De Vlieger, Dec 31 2018 *)
  • PARI
    A007947(n) = factorback(factorint(n)[, 1]); \\ From Andrew Lelechenko, May 09 2014
    A285328(n) = { my(r=A007947(n)); if(core(n)==n,1,n = n-r; while(A007947(n) <> r, n = n-r); n); }; \\ After Python-code below - Antti Karttunen, Apr 17 2017
    A285328(n) = { my(r); if((n > 1 && !bitand(n,(n-1))),(n/2), r=A007947(n); if(r==n,1,n = n-r; while(A007947(n) <> r, n = n-r); n)); }; \\ Version optimized for powers of 2.
    
  • Python
    from operator import mul
    from sympy import primefactors
    from sympy.ntheory.factor_ import core
    def a007947(n): return 1 if n<2 else reduce(mul, primefactors(n))
    def a(n):
        if core(n) == n: return 1
        r = a007947(n)
        k = n - r
        while k>0:
            if a007947(k) == r: return k
            else: k -= r
    print([a(n) for n in range(1, 121)]) # Indranil Ghosh and Antti Karttunen, Apr 17 2017
  • Scheme
    (definec (A285328 n) (if (not (zero? (A008683 n))) 1 (let ((k (A007947 n))) (let loop ((n (- n k))) (if (= (A007947 n) k) n (loop (- n k)))))))
    

Formula

If A008683(n) <> 0, a(n) = 1, otherwise a(n) = the largest number k < n for which A007947(k) = A007947(n).
Other identities. For all n >= 1:
a(A065642(n)) = n.