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

A369861 The orbit of n under iterations of x -> concatenate(A048762(x), A055400(x)) enters a pseudo-loop x(k) = a^3 * 10^((k-k0)*A055642(b)) + b for k > k0. This sequence lists the b-value.

Original entry on oeis.org

586, 587, 588, 589, 590, 591, 592, 584, 585, 586, 587, 588, 589, 590, 591, 592, 593, 748673, 748674, 748675, 748676, 748677, 748678, 748679, 748680, 748681, 709030, 709031, 709032, 709033, 709034, 709035, 709036, 709037, 709038, 709039, 513, 514, 515, 516, 517, 518, 519, 520
Offset: 1

Views

Author

M. F. Hasler, Apr 03 2024

Keywords

Comments

The iterated function can also be defined as x -> c(x)*(10^L(x-c(x))-1) + x, where c(x) = A048762(x) = floor(x^(1/3))^3 is the largest perfect cube <= x; A055400(x) = x-c(x) is the "cube excess" of x, and L(x) = A055642(x) = floor(log_10(max(x,1))+1) is the number of decimal digits of x.
Often a(n+1) = a(n) + 1, especially when c(n+1) = c(n), in which case it is probable that all elements of the orbit of n+1 are just one larger than the elements of the orbit of n.

Examples

			Starting with 1, we get 1 -> 10 -> 82 (since 8 is the largest cube <= 10, at distance 2) -> 6418 (since the cube 64 is at distance 18) -> 5832586 (since 5832 = 18^3 is at distance 586) -> 5832000586 (since 180^3 is again at distance 586) -> ...: Each time 3 '0's will be inserted in front of the remainder which remains always the same, a(1) = 586, as does the cube root up to an additional factor of 10.
Starting with 2, we get 2 -> 11 (since the largest cube <= 2 is 1, at distance 1) -> 83 (since largest cube <= 11 is 8, at distance 2) -> 6419(since the cube 64 is at distance 19) -> 5832587 (since 5832 = 18^3 is at distance 587) -> 5832000587 (since 180^3 is again at distance 587) -> ... We see that in this sequence each term is one more than that of the preceding sequence, whence also a(2) = 587 = a(1)+1.
Starting with 8, we get 8 -> 80 (since the largest cube <= 8 is 8, at distance 0) -> 6416 (since the cube 64 is at distance 16, two less than in 1's orbit) -> 5832584 (since 5832 = 18^3 is at distance 584, again 2 less than in 1's orbit) -> 5832000584 (since 180^3 is again at distance 584) -> ... We see that in this sequence each term is 2 (resp. 8) less than the corresponding term of 1's (resp. 7's) orbit (with the initial term deleted). Hence also a(8) = 584 = a(7)-8 = a(1)-2. From here on subsequent terms will again increase by 1 up to n = 17.
Starting with 18, we get 18 -> 810 (since the largest cube <= 18 is 8, at distance 10) -> 72981 (since the cube 729 is at distance 81) -> 689214060 (since 68921 = 41^3 is at distance 4060) -> 688465387748673 (since 688465387 = 883^3 is at distance 748673), from where on the cube roots get multiplied by 10 and the distance from the cubes remains the same, a(18) = 748673.
For n = 64 -> 640 (= 8^3 + 128) -> 512128 = 80^3 + 128, we have a(n) = 128.
		

Crossrefs

Cf. A000578 (cubes), A048766 (cube root), A048762 (largest cube <= n), A055400 (cube excess), A055642 (length of n in base 10), A122840 (10-valuation of n).
Cf. A369860 (a-values)

Programs

  • PARI
    A369861(n)={until(, my(c=sqrtnint(n,3), v=valuation(c,10), L=logint(max(n-c^3,1),10)+1); L==v*3 && return(n-c^3); n += c^3*(10^L-1))}
    
  • Python
    import sympy
    def A369861(n: int):
        while True:
            C = sympy.integer_nthroot(n, 3)[0]**3; L = A055642(n-C)
            if sympy.multiplicity(10, C) == L: return n-C
            n += C * (10**L - 1)

A055500 a(0)=1, a(1)=1, a(n) = largest prime <= a(n-1) + a(n-2).

Original entry on oeis.org

1, 1, 2, 3, 5, 7, 11, 17, 23, 37, 59, 89, 139, 227, 359, 577, 929, 1499, 2423, 3919, 6337, 10253, 16573, 26821, 43391, 70207, 113591, 183797, 297377, 481171, 778541, 1259701, 2038217, 3297913, 5336129, 8633983, 13970093, 22604069, 36574151, 59178199, 95752333
Offset: 0

Views

Author

N. J. A. Sloane, Jul 08 2000

Keywords

Comments

Or might be called Ishikawa primes, as he proved that prime(n+2) < prime(n) + prime(n+1) for n > 1. This improves on Bertrand's Postulate (Chebyshev's theorem), which says prime(n+2) < prime(n+1) + prime(n+1). - Jonathan Sondow, Sep 21 2013

Examples

			a(8) = 23 because 23 is largest prime <= a(7) + a(6) = 17 + 11 = 28.
		

Crossrefs

Programs

  • Haskell
    a055500 n = a055500_list !! n
    a055500_list = 1 : 1 : map a007917
                   (zipWith (+) a055500_list $ tail a055500_list)
    -- Reinhard Zumkeller, May 01 2013
    
  • Mathematica
    PrevPrim[n_] := Block[ {k = n}, While[ !PrimeQ[k], k-- ]; Return[k]]; a[1] = a[2] = 1; a[n_] := a[n] = PrevPrim[ a[n - 1] + a[n - 2]]; Table[ a[n], {n, 1, 42} ]
    (* Or, if version >= 6 : *)a[0] = a[1] = 1; a[n_] := a[n] = NextPrime[ a[n-1] + a[n-2] + 1, -1]; Table[a[n], {n, 0, 100}](* Jean-François Alcover, Jan 12 2012 *)
    nxt[{a_,b_}]:={b,NextPrime[a+b+1,-1]}; Transpose[NestList[nxt,{1,1},40]] [[1]] (* Harvey P. Dale, Jul 15 2013 *)
  • Python
    from sympy import prevprime; L = [1, 1]
    for _ in range(36): L.append(prevprime(L[-2] + L[-1] + 1))
    print(*L, sep = ", ")  # Ya-Ping Lu, May 05 2023

Formula

a(n) is asymptotic to C*phi^n where phi = (1+sqrt(5))/2 and C = 0.41845009129953131631777132510164822489... - Benoit Cloitre, Apr 21 2003
a(n) = A007917(a(n-1) + a(n-2)) for n > 1. - Reinhard Zumkeller, May 01 2013
a(n) >= prime(n-1) for n > 1, by Ishikawa's theorem. - Jonathan Sondow, Sep 21 2013

A055401 Number of positive cubes needed to sum to n using the greedy algorithm.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 1, 2, 3, 4, 5, 6, 7, 8, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7, 8, 9, 10, 4, 5, 6, 2, 3, 4, 5, 6, 7, 8, 9, 3, 4, 5, 6, 7
Offset: 0

Views

Author

Henry Bottomley, May 16 2000

Keywords

Comments

Define f(n) = n - k^3 where (k+1)^3 > n >= k^3; a(n) = number of steps such that f(f(...f(n)))= 0.
Also sum of digits when writing n in base where place values are positive cubes, cf. A000433. [Reinhard Zumkeller, May 08 2011]

Examples

			a(32)=6 because 32=27+1+1+1+1+1 (not 32=8+8+8+8).
a(33)=7 because 33=27+1+1+1+1+1+1 (not 33=8+8+8+8+1).
		

Crossrefs

Cf. A002376 (least number of positive cubes needed to represent n; differs from this sequence for the first time at n=32, where a(32)=6, while A002376(32)=4).

Programs

  • Haskell
    a055401 n = s n $ reverse $ takeWhile (<= n) $ tail a000578_list where
      s _ []                 = 0
      s m (x:xs) | x > m     = s m xs
                 | otherwise = m' + s r xs where (m',r) = divMod m x
    -- Reinhard Zumkeller, May 08 2011
    (Scheme, with memoization-macro definec)
    (definec (A055401 n) (if (zero? n) n (+ 1 (A055401 (A055400 n)))))
    ;; Antti Karttunen, Aug 16 2015
  • Maple
    f:= proc(n,k) local m, j;
    if n = 0 then return 0 fi;
    for j from k by -1 while j^3 > n do od:
    m:= floor(n/j^3);
    m + procname(n-m*j^3, j-1);
    end proc:
    seq(f(n,floor(n^(1/3))),n=0..100); # Robert Israel, Aug 17 2015
  • Mathematica
    a[0] = 0; a[n_] := {n} //. {b___, c_ /; !IntegerQ[c^(1/3)], d___} :> {b, f = Floor[c^(1/3)]^3, c - f, d} // Length; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Aug 17 2015 *)
  • PARI
    F=vector(30,n,n^3); /* modify to get other sequences of "greedy representations" */ last_leq(v,F)=
    { /* Return last element <=v in sorted array F[] */
        local(j=1);
        while ( F[j]<=v, j+=1 );
        return( F[j-1] );
    }
    greedy(n,F)=
    {
        local(v=n,ct=0);
        while ( v,  v-=last_leq(v,F); ct+=1; );
        return(ct);
    }
    vector(min(100,F[#F-1]),n,greedy(n,F)) /* show terms */
    /* Joerg Arndt, Apr 08 2011 */
    

Formula

a(0) = 0; for n >= 1, a(n) = a(n-floor(n^(1/3))^3)+1 = a(A055400(n))+1 = a(n-A048762(n))+1.

Extensions

a(0) = 0 prepended by Antti Karttunen, Aug 16 2015

A104492 Cube excess of the n-th prime.

Original entry on oeis.org

1, 2, 4, 6, 3, 5, 9, 11, 15, 2, 4, 10, 14, 16, 20, 26, 32, 34, 3, 7, 9, 15, 19, 25, 33, 37, 39, 43, 45, 49, 2, 6, 12, 14, 24, 26, 32, 38, 42, 48, 54, 56, 66, 68, 72, 74, 86, 7, 11, 13, 17, 23, 25, 35, 41, 47, 53, 55, 61, 65, 67, 77, 91, 95, 97, 101, 115, 121, 4, 6, 10, 16, 24, 30
Offset: 1

Views

Author

Jonathan Vos Post, Mar 10 2005

Keywords

Examples

			a(48) = 7 because the 48th prime is 223 and 223 - 6^3 = 7, while 223 - 7^3 = -120.
		

Crossrefs

Programs

Formula

a(n) = A055400(A000040(n)).
a(n) = prime(n) - floor(prime(n)^(1/3))^3. - Jon E. Schoenfield, Jan 17 2015

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 *)

A369860 The orbit of n under iterations of x -> c(x)*10^L(x-c(x)) + x-c(x), where c(x) = floor(x^(1/3))^3, L(x) = floor(log_10(max(x,1))+1), enters a pseudo-loop x(k) = a^3 * 10^((k-k0)*L(b)) + b beyond some k0. This sequence lists the a-values.

Original entry on oeis.org

18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 883, 883, 883, 883, 883, 883, 883, 883, 883, 581, 581, 581, 581, 581, 581, 581, 581, 581, 581, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 8, 8, 8, 8
Offset: 1

Views

Author

M. F. Hasler, Apr 05 2024

Keywords

Comments

The iterated function can also be defined as x -> concatenate(c(x), x-c(x)), where c = A048762 gives the largest perfect cube <= x and x - c(x) = A055400(x) is the "cube excess" of x. L = A055642 gives the number of decimal digits.
The corresponding b-values are listed in A369861.

Examples

			Starting with 1, we get 1 -> 10 -> 82 (since 8 is the largest cube <= 10, at distance 2) -> 6418 (since the cube 64 is at distance 18) -> 5832586 (since 5832 = 18^3 is at distance 586) -> 5832000586 (since 180^3 is again at distance 586) -> ...: Each time 3 '0's will be inserted in front of the remainder which remains always the same, as does the cube root a(1) = 18, up to factors of 10.
Starting with 2, we get 2 -> 11 (since the largest cube <= 2 is 1, at distance 1) -> 83 (since largest cube <= 11 is 8, at distance 2) -> 6419 (since the cube 64 is at distance 19) -> 5832587 (since 5832 = 18^3 is at distance 587). We see that in this sequence each term is just one more than that of the preceding sequence, so the cube root remains the same, a(2) = a(1) = 18.
For n = 18, we get 18 -> 810 (since the largest cube <= 18 is 8, at distance 10) -> 72981 (since the cube 729 is at distance 81) -> 689214060 (since 68921 = 41^3 is at distance 4060) -> 688465387748673 (since 688465387 = 883^3 is at distance 748673), from where on the cube root a(18) = 883 gets an additional factor 10 at each step, but the cube excess A055400 remains the same, A369861(18) = 748673.
See A369861 for more examples.
		

Crossrefs

Cf. A000578 (cubes), A048766 (cube root), A048762 (largest cube <= n), A055400 (cube excess), A055642 (length of n in base 10), A122840 (10-valuation of n).
Cf. A369861 (b-values).

Programs

  • PARI
    A369860(n)={until(, my(c=sqrtnint(n, 3), v=valuation(c, 10), L=logint(max(n-c^3, 1), 10)+1); L==v*3 && return(c/10^v); n += c^3*(10^L-1))}
    
  • Python
    import sympy # for integer_nthroot (A048766), multiplicity (A122840)
    def A369860(n: int):
        while True:
            C = sympy.integer_nthroot(n, 3)[0]; L = A055642(n-C**3)
            if sympy.multiplicity(10, C)*3 == L: return C//10**(L//3)
            n += C**3 * (10**L - 1)

A060511 Hexagonal excess: smallest amount by which n exceeds a hexagonal number (2k^2-k, A000384).

Original entry on oeis.org

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

Views

Author

Henry Bottomley, Mar 22 2001

Keywords

Examples

			a(19)=4 since 15(=2*3^2-3) is the largest hexagonal less than or equal to 19 and 19-15=4.
		

Crossrefs

Programs

  • Mathematica
    Flatten[Range[#]&/@Differences[Array[#(2#-1)&,10,0]]-1] (* Harvey P. Dale, Jun 05 2013 *)

A273555 a(n) = A001235(n) - floor(A001235(n)^(1/3))^3.

Original entry on oeis.org

1, 8, 8, 1000, 64, 8, 729, 27, 232, 1728, 64, 216, 1728, 512, 8000, 4913, 729, 27, 125, 512, 64, 5832, 13331, 216, 13580, 125, 4913, 1000, 1856, 3375, 13824, 7073, 343, 2547, 8, 1331, 12167, 512, 1728, 8000, 13824, 13768, 24389, 9736, 16496, 216, 12167, 13824, 19683, 1
Offset: 1

Views

Author

Altug Alkan, May 25 2016

Keywords

Comments

Noncube terms of this sequence are 232, 13331, 13580, 1856, 7073, 2547, ...
How is the distribution of noncube terms in this sequence? See also A273592 that is related with this question.

Crossrefs

Programs

  • PARI
    T = thueinit(x^3+1, 1);
    isA001235(n) = my(v=thue(T, n)); sum(i=1, #v, v[i][1]>=0 && v[i][2]>=v[i][1])>1;
    lista(nn) = for(n=1, nn, if(isA001235(n), print1(n-sqrtnint(n,3)^3, ", ")));

Formula

a(n) = A055400(A001235(n)). - Michel Marcus, May 25 2016

A333884 Difference between smallest cube > n and n.

Original entry on oeis.org

1, 7, 6, 5, 4, 3, 2, 1, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45
Offset: 0

Views

Author

Ilya Gutkovskiy, Apr 08 2020

Keywords

Comments

a(n) is the smallest positive number k such that n + k is a cube.

Crossrefs

Programs

  • Mathematica
    Table[Floor[n^(1/3) + 1]^3 - n, {n, 0, 80}]

Formula

a(n) = floor(n^(1/3) + 1)^3 - n.

A104493 Numbers n for which the cube excess of the n-th prime is prime.

Original entry on oeis.org

2, 5, 6, 8, 10, 19, 20, 23, 26, 28, 31, 48, 49, 50, 51, 52, 55, 56, 57, 59, 61, 65, 66, 99, 100, 105, 110, 112, 114, 117, 121, 125, 127, 170, 171, 173, 178, 184, 185, 186, 190, 192, 194, 196, 200, 201, 206, 208, 214, 270, 271, 272, 274, 277, 278, 279, 280, 282
Offset: 1

Views

Author

Jonathan Vos Post, Mar 19 2005

Keywords

Examples

			99 is an element of this sequence because the 99th prime is 523, 523 - 8^3 = 523-512 = 11 and 11 is prime. 100 is in this sequence because the 100th prime is 541 and 541-8^3 = 29, which is prime.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = 1, p = Prime[n]}, While[k^3 < p, k++ ]; p - (k - 1)^3]; Select[ Range[ 284], PrimeQ[ f[ # ]] &] (* Robert G. Wilson v, Mar 19 2005 *)

Formula

n such that A055400(A000040(n)) is an element of A000040. n such that A104492(n) is prime.

Extensions

More terms from Robert G. Wilson v, Mar 19 2005
Showing 1-10 of 10 results.