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.

A154840 Distance to nearest cube different from n.

Original entry on oeis.org

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

Views

Author

R. J. Mathar, Nov 01 2009

Keywords

Comments

Equals A074989(n) if this is not zero, else 1+A055400(n-1), the distance to the nearest cube < n.

Examples

			a(8)=7, because the two cubes below and above 8 are 1^3=1 and 3^3=27, and the distance to 1 is smaller, namely 8-1=7.
		

Crossrefs

Programs

  • Maple
    distNearstDiffCub := proc(n) local iscbr ; iroot(n,3,'iscbr') ; if iscbr then 1+A055400(n-1); else A074989(n) ; end if; end proc;
  • Mathematica
    dnc[n_]:=Module[{c=Surd[n,3]},If[IntegerQ[c],n-(c-1)^3,Min[n-Floor[ c]^3, Ceiling[c]^3-n]]]; Array[dnc,90,0] (* Harvey P. Dale, Mar 30 2019 *)

A164834 Numbers such that the two adjacent integers are a perfect cube and a prime.

Original entry on oeis.org

2, 28, 126, 728, 3374, 6858, 19682, 24390, 29790, 50652, 91126, 250048, 274626, 300762, 328510, 357912, 571788, 753570, 970298, 1157626, 1295028, 1442898, 1771560, 1860868, 2146688, 2146690, 2460374, 2924208, 3048624, 3442950, 3581578, 4492124, 5000212
Offset: 1

Views

Author

Gaurav Kumar, Aug 28 2009

Keywords

Comments

Subsequence of A163497.

Examples

			2 is a term since 2 has adjacent numbers 1 (cube) and 3 (prime).
28 is a term since 28 has adjacent numbers 27 (cube) and 29 (prime).
728 is a term since 728 has adjacent numbers 727 (prime) and 729 (cube).
		

Crossrefs

Programs

  • Mathematica
    Select[Which[PrimeQ[ #+2],#+1,PrimeQ[ #-2],#-1,True,0]&/@(Range[1000]^3),#!=0&] (* Harvey P. Dale, Sep 29 2009 *)
  • Python
    from sympy import isprime
    def aupto(limit):
      i, c, alst = 1, 1, []
      while c <= limit + 1:
        if isprime(c-2) and c-1 <= limit: alst.append(c-1)
        if isprime(c+2) and c+1 <= limit: alst.append(c+1)
        i += 1
        c = i**3
      return alst
    print(aupto(5000212)) # Michael S. Branicky, Feb 28 2021

Extensions

Edited by Zak Seidov, Aug 30 2009
a(20)-a(30) from Donovan Johnson, Sep 16 2009
Showing 1-2 of 2 results.