login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A233075
Numbers that are midway between the nearest square and the nearest cube.
4
6, 26, 123, 206, 352, 498, 1012, 1350, 1746, 2203, 2724, 3428, 4977, 5804, 6874, 8050, 9335, 10732, 12244, 13874, 17500, 19782, 21928, 24519, 26948, 29860, 32946, 35829, 39254, 42862, 50639, 54814, 59184, 63752, 69045, 74036, 79234, 85224, 90863, 97340, 104076
OFFSET
1,1
COMMENTS
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, ...
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)
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, ...
If we allow k2=k3 then first missing terms are 0, 1, 64, 729, 4096, ... . - Zak Seidov, Dec 10 2013
LINKS
Zak Seidov and Charles R Greathouse IV, Table of n, a(n) for n = 1..10000 (first 2108 from Seidov)
EXAMPLE
26 = 5^2 + 1 = 3^3 - 1.
352 = 19^2 - 9 = 7^3 + 9.
MATHEMATICA
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 *)
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 *)
PROG
(Java)
import java.math.*;
public class A233075 {
public static void main (String[] args) {
for (long k = 1; ; k++) { // ok for small k's
long r2=(long)Math.sqrt(k), r3=(long)Math.cbrt(k);
long b2=r2*r2, a2=b2+r2*2+1; //squares below and above
long b3=r3*r3*r3, a3=b3+3*r3*(r3+1)+1; //cubes below, above
if ((b2+a3==k*2 && k-b2<=a2-k && a3-k<=k-b3) ||
(b3+a2==k*2 && k-b3<=a3-k && a2-k<=k-b2))
System.out.printf("%d, ", k);
}
}
}
(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
a=[]
for c in range(1, 10000):
cube = c*c*c
srB = isqrt(cube)
srB2= srB**2
if srB2==cube: continue
if ((srB2^cube)&1)==0:
n = (srB2+cube)//2
else:
n = (srB2+2*srB+1+cube)//2
a.append(n)
print(a)
(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
CROSSREFS
Cf. A002760 (Squares and cubes).
Cf. A001014 (Additional terms if k2=k3 were allowed).
Sequence in context: A164549 A283341 A046647 * A307331 A298625 A046233
KEYWORD
nonn,nice,easy
AUTHOR
Alex Ratushnyak, Dec 03 2013
STATUS
approved