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.

A233075 Numbers that are midway between the nearest square and the nearest cube.

This page as a plain text file.
%I A233075 #48 May 07 2021 09:10:13
%S A233075 6,26,123,206,352,498,1012,1350,1746,2203,2724,3428,4977,5804,6874,
%T A233075 8050,9335,10732,12244,13874,17500,19782,21928,24519,26948,29860,
%U A233075 32946,35829,39254,42862,50639,54814,59184,63752,69045,74036,79234,85224,90863,97340,104076
%N A233075 Numbers that are midway between the nearest square and the nearest cube.
%C A233075 The sequence of roots of nearest squares begins: 2, 5, 11, 14, 19, 22, 32, 37, 42, 47, 52, 59, 71, 76, 83, 90, 97, 104, 111, 118, 132, ...
%C A233075 The sequence of cube roots of nearest cubes begins: 2, 3, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 26, ... (Cf. A000037)
%C A233075 The sequence of k-k2 (equals k3-k) begins: 2, 1, 2, 10, -9, 14, -12, -19, -18, -6, 20, -53, -64, 28, -15, -50, -74, -84, -77, -50, ...
%C A233075 If we allow k2=k3 then first missing terms are 0, 1, 64, 729, 4096, ... . - _Zak Seidov_, Dec 10 2013
%H A233075 Zak Seidov and Charles R Greathouse IV, <a href="/A233075/b233075.txt">Table of n, a(n) for n = 1..10000</a> (first 2108 from Seidov)
%e A233075 26 = 5^2 + 1 = 3^3 - 1.
%e A233075 352 = 19^2 - 9 = 7^3 + 9.
%t A233075 max = 10^6; u = Union[Range[Ceiling[Sqrt[max]]]^2,Range[Ceiling[ max^(1/3) ]]^3]; Reap[Do[x = u[[k]]; y = u[[k+1]]; If[Not[IntegerQ[Sqrt[x]] && IntegerQ[Sqrt[y]]] && Not[IntegerQ[x^(1/3)] && IntegerQ[y^(1/3)]] && IntegerQ[m = (x+y)/2], Sow[m]], {k, 1, Length[u]-2}]][[2, 1]] (* _Jean-François Alcover_, Dec 03 2015 *)
%t A233075 Module[{upto=150000,nns},nns=Union[Join[Range[Floor[Sqrt[upto]]]^2,Range[Floor[Surd[upto,3]]]^3]];Mean/@Select[Partition[nns,2,1],EvenQ[Total[#]]&]] (* _Harvey P. Dale_, Nov 06 2017 *)
%o A233075 (Java)
%o A233075 import java.math.*;
%o A233075 public class A233075 {
%o A233075   public static void main (String[] args) {
%o A233075     for (long k = 1; ; k++) { // ok for small k's
%o A233075       long r2=(long)Math.sqrt(k), r3=(long)Math.cbrt(k);
%o A233075       long b2=r2*r2, a2=b2+r2*2+1; //squares below and above
%o A233075       long b3=r3*r3*r3, a3=b3+3*r3*(r3+1)+1; //cubes below, above
%o A233075       if ((b2+a3==k*2 && k-b2<=a2-k && a3-k<=k-b3) ||
%o A233075           (b3+a2==k*2 && k-b3<=a3-k && a2-k<=k-b2))
%o A233075             System.out.printf("%d, ", k);
%o A233075     }
%o A233075   }
%o A233075 }
%o A233075 (Python)
%o A233075 def isqrt(a):
%o A233075     sr = 1 << (int.bit_length(int(a)) >> 1)
%o A233075     while a < sr*sr:  sr>>=1
%o A233075     b = sr>>1
%o A233075     while b:
%o A233075         s = sr + b
%o A233075         if a >= s*s:  sr = s
%o A233075         b>>=1
%o A233075     return sr
%o A233075 a=[]
%o A233075 for c in range(1, 10000):
%o A233075     cube = c*c*c
%o A233075     srB = isqrt(cube)
%o A233075     srB2= srB**2
%o A233075     if srB2==cube: continue
%o A233075     if ((srB2^cube)&1)==0:
%o A233075         n = (srB2+cube)//2
%o A233075     else:
%o A233075         n = (srB2+2*srB+1+cube)//2
%o A233075     a.append(n)
%o A233075 print(a)
%o A233075 (PARI) list(lim)=my(v=List(),m=2,n=2,m2=4,n3=8,s=12); lim*=2; while(s <= lim, if(s%2==0 && m2!=n3 && abs(s/2-m2)<=abs(s/2-(m-1)^2) && abs(s/2-m2)<=abs(s/2-(m+1)^2) && abs(s/2-m2)<=abs(s/2-(n-1)^3) && abs(s/2-m2)<=abs(s/2-(n+1)^3), listput(v,s/2)); if(m2<n3, m2=m++^2, m2>n3, n3=n++^3, m2=m++^2; n3=n++^3); s=m2+n3); Vec(v) \\ _Charles R Greathouse IV_, Jul 29 2016
%Y A233075 Cf. A000290, A000578, A075454, A233074.
%Y A233075 Cf. A002760 (Squares and cubes).
%Y A233075 Cf. A001014 (Additional terms if k2=k3 were allowed).
%K A233075 nonn,nice,easy
%O A233075 1,1
%A A233075 _Alex Ratushnyak_, Dec 03 2013