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

A285734 a(1) = 0, and for n > 1, a(n) = the largest squarefree number x such that x < n-x, and n-x is also squarefree.

Original entry on oeis.org

0, 1, 1, 2, 2, 3, 2, 3, 3, 5, 5, 6, 6, 7, 5, 6, 7, 7, 6, 10, 10, 11, 10, 11, 11, 13, 13, 14, 14, 15, 14, 15, 14, 17, 14, 17, 15, 19, 17, 19, 19, 21, 21, 22, 22, 23, 21, 22, 23, 21, 22, 26, 23, 23, 26, 26, 26, 29, 29, 30, 30, 31, 30, 31, 31, 33, 33, 34, 34, 35, 34, 35, 35, 37, 37, 38, 38, 39, 38, 39, 39, 41, 41, 42, 42, 43, 41, 42, 43, 43, 38, 46, 46, 47, 42
Offset: 1

Views

Author

Antti Karttunen, May 02 2017

Keywords

Comments

For n > 1, a(n) = the largest squarefree number x <= n/2 for which n-x is also squarefree.
For any n > 1 there is at least one decomposition of n as a sum of two squarefree numbers (cf. A071068 and the Mathematics Stack Exchange link). Of all pairs (x,y) of squarefree numbers for which x <= y and x+y = n, sequences A285734 and A285735 give the unique pair for which the difference y-x is the least possible.

Crossrefs

Programs

  • PARI
    a(n)=forstep(x=n\2,1,-1, if(issquarefree(x) && issquarefree(n-x), return(x))); 0 \\ Charles R Greathouse IV, Nov 05 2017
  • Python
    from sympy.ntheory.factor_ import core
    def issquarefree(n): return core(n) == n
    def a285734(n):
        if n==1: return 0
        j=n//2
        while True:
            if issquarefree(j) and issquarefree(n - j): return j
            else: j-=1
    print([a285734(n) for n in range(1, 101)]) # Indranil Ghosh, May 02 2017
    
  • Scheme
    (define (A285734 n) (if (= 1 n) 0 (let loop ((j 1) (k (- n 1)) (s 0)) (if (> j k) s (loop (+ 1 j) (- k 1) (max s (* j (A008966 j) (A008966 k))))))))
    ;; Much faster version:
    (define (A285734 n) (if (= 1 n) 0 (let loop ((j (floor->exact (/ n 2)))) (if (and (= 1 (A008966 j)) (= 1 (A008966 (- n j)))) j (loop (- j 1))))))
    

Formula

a(n) = n - A285735(n).

A285735 a(1) = 1, and for n > 1, a(n) = the least squarefree number x such that x > n-x, and n-x is also squarefree.

Original entry on oeis.org

1, 1, 2, 2, 3, 3, 5, 5, 6, 5, 6, 6, 7, 7, 10, 10, 10, 11, 13, 10, 11, 11, 13, 13, 14, 13, 14, 14, 15, 15, 17, 17, 19, 17, 21, 19, 22, 19, 22, 21, 22, 21, 22, 22, 23, 23, 26, 26, 26, 29, 29, 26, 30, 31, 29, 30, 31, 29, 30, 30, 31, 31, 33, 33, 34, 33, 34, 34, 35, 35, 37, 37, 38, 37, 38, 38, 39, 39, 41, 41, 42, 41, 42, 42, 43, 43, 46, 46, 46, 47, 53, 46, 47, 47
Offset: 1

Views

Author

Antti Karttunen, May 02 2017

Keywords

Comments

For n > 1, a(n) = the least squarefree number x >= n/2 for which n-x is also squarefree.
For any n > 1 there is at least one decomposition of n as a sum of two squarefree numbers (cf. A071068 and the Mathematics Stack Exchange link). Of all pairs (x,y) of squarefree numbers for which x <= y and x+y = n, sequences A285734 and A285735 give the unique pair for which the difference y-x is the least possible.

Crossrefs

Programs

  • PARI
    a(n)=for(x=(n+1)\2,n, if(issquarefree(x) && issquarefree(n-x), return(x))); 1 \\ Charles R Greathouse IV, Nov 05 2017
  • Python
    from sympy.ntheory.factor_ import core
    def issquarefree(n): return core(n) == n
    def a285734(n):
        if n==1: return 0
        j=n//2
        while True:
            if issquarefree(j) and issquarefree(n - j): return j
            else: j-=1
    def a285735(n): return n - a285734(n)
    print([a285735(n) for n in range(1, 101)]) # Indranil Ghosh, May 02 2017
    
  • Scheme
    (define (A285735 n) (- n (A285734 n)))
    

Formula

a(n) = n - A285734(n).

A285718 a(1) = 0, and for n > 1, a(n) = the least squarefree number x such that n-x is also squarefree.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, May 02 2017

Keywords

Comments

For any n > 1 there is at least one decomposition of n as a sum of two squarefree numbers (cf. A071068 and the Mathematics Stack Exchange link). Of all pairs (x,y) of positive squarefree numbers for which x <= y and x+y = n, sequences A285718 and A285719 give the unique pair for which the difference y-x is the largest possible.
Question: Are there arbitrarily large terms in this sequence?

Examples

			For n=51 we see that 50 (2*5*5), 49 (7*7) and 48 (2^4 * 3) are all nonsquarefree (A013929). 47 (a prime) is squarefree, but 51 - 47 = 4 is not. On the other hand, both 46 (2*23) and 5 are squarefree numbers, thus a(51) = 5.
		

Crossrefs

Programs

  • Mathematica
    Table[If[n == 1, 0, x = 1; While[Nand[SquareFreeQ@ x, SquareFreeQ[n - x]], x++]; x], {n, 120}] (* Michael De Vlieger, May 03 2017 *)
  • Python
    from sympy.ntheory.factor_ import core
    def issquarefree(n): return core(n) == n
    def a285718(n):
        if n==1: return 0
        x = 1
        while True:
            if issquarefree(x) and issquarefree(n - x):return x
            else: x+=1
    print([a285718(n) for n in range(1, 121)]) # Indranil Ghosh, May 02 2017
  • Scheme
    (define (A285718 n) (if (= 1 n) 0 (let loop ((k 1)) (if (not (zero? (A008683 (- n (A005117 k))))) (A005117 k) (loop (+ 1 k))))))
    

Formula

a(n) = n - A285719(n).
Showing 1-3 of 3 results.