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.

A253181 Numbers n such that the distance between n^3 and the nearest square is less than n.

Original entry on oeis.org

1, 2, 3, 4, 5, 9, 13, 15, 16, 17, 25, 32, 35, 36, 37, 40, 43, 46, 49, 52, 56, 63, 64, 65, 81, 99, 100, 101, 109, 121, 136, 143, 144, 145, 152, 158, 169, 175, 190, 195, 196, 197, 225, 243, 255, 256, 257, 289, 312, 317, 323, 324, 325, 331, 336, 351, 356, 361, 366, 377
Offset: 1

Views

Author

Alex Ratushnyak, Mar 23 2015

Keywords

Comments

Distance can be zero, that is, cubes that are squares are included.
Numbers n such that A002938(n) < n.

Examples

			The distance between 5^3=125 and the nearest square 11^2=121 is less than 5, so 5 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    dnsQ[n_]:=Module[{n3=n^3,sr},sr=Sqrt[n3];Min[n3-Floor[sr]^2, Ceiling[ sr]^2- n3]Harvey P. Dale, Dec 23 2015 *)
  • Python
    def isqrt(a):
        sr = 1 << (int.bit_length(int(a)) >> 1)
        while a < sr*sr:  sr>>=1
        b = sr>>1
        while b:
            s = sr + b
            if a >= s*s:  sr = s
            b>>=1
        return sr
    for n in range(1000):
        cube = n*n*n
        r = isqrt(cube)
        sqr = r**2
        if cube-sqr < n or sqr+2*r+1-cube < n:  print(str(n), end=',')

A268509 Numbers x such that x^3 = y^2 + z for some y and some nonzero z with -x < z < x.

Original entry on oeis.org

2, 3, 5, 13, 15, 17, 32, 35, 37, 40, 43, 46, 52, 56, 63, 65, 99, 101, 109, 136, 143, 145, 152, 158, 175, 190, 195, 197, 243, 255, 257, 312, 317, 323, 325, 331, 336, 351, 356, 366, 377, 399, 401, 422, 483, 485, 560, 568, 575, 577, 584, 592, 654, 675, 677, 717, 741, 783, 785, 799, 810, 891, 899, 901, 909, 937, 944, 978
Offset: 1

Views

Author

Daniel Mondot, Feb 06 2016

Keywords

Comments

List of x such as x^3 is a near square (see examples).
Note that z = 17 appears often (see A029728).

Examples

			2^3 = 3^2 - 1;
3^3 = 5^2 + 2;
5^3 = 11^2 + 4;
13^3 = 47^2 - 12;
15^3 = 58^2 + 11;
17^3 = 70^2 + 13;
32^3 = 181^2 + 7;
35^3 = 207^2 + 26;
37^3 = 225^2 + 28;
40^3 = 253^2 - 9;
43^3 = 282^2 - 17;
46^3 = 312^2 - 8;
52^3 = 375^2 - 17;
56^3 = 419^2 + 55;
63^3 = 500^2 + 47;
65^3 = 524^2 + 49;
99^3 = 985^2 + 74.
		

Crossrefs

Programs

  • C
    #include 
    #include 
    #include 
    #define MAX2 10000
    /* list number x and y such that x^3 = y^2 ± delta (0 < delta < x) */
    /* this generates A268509 and A268510 */
    long long unsigned b,c,d;
    long long signed ds;
    unsigned long long list2[MAX2];
    unsigned long long list3[MAX2];
    long double b1, cd, dd;
    void main(unsigned argc, char *argv[])
    {
    unsigned a, i;
      i=0;
      // I never actually calculate b^3 or c^2, but only b^(3/2) = c + ds
      // this allows me to indirectly check b^3 past 2^64
      for (b=0; b<100000000; ++b) // could go up to b<4294967295u; max
      {
        b1 = sqrtl(b);
        cd= b1 *(long double)b;
        c=(long long unsigned)(cd+(double)0.5);
        dd = 2 * c * (cd - c);
        if (dd<0) ds = (dd - 0.5);
        else ds = (dd + 0.5);
        d = llabs(ds);
        if (dA268509 */
      for (a=0; aA268510 */
      for (a=0; a
    				
  • PARI
    is(n)=my(t=abs(n^3-round(n^1.5)^2)); 0Charles R Greathouse IV, Feb 09 2016
Showing 1-2 of 2 results.