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

A071176 Smallest k such that the concatenation of n and k is a square (decimal notation).

Original entry on oeis.org

6, 5, 6, 9, 29, 4, 29, 1, 61, 0, 56, 1, 69, 4, 21, 9, 64, 49, 6, 25, 16, 5, 104, 336, 6, 244, 225, 9, 16, 25, 36, 4, 64, 81, 344, 1, 21, 44, 69, 0, 209, 25, 56, 1, 369, 24, 61, 4, 284, 41, 84, 9, 29, 76, 225, 25, 6, 564, 29, 84, 504, 5, 504
Offset: 1

Views

Author

Reinhard Zumkeller, May 15 2002

Keywords

Comments

a(n) = 1 correspond to n = A132356(m), m > 0. - Bill McEachen, Aug 31 2023

Examples

			a(5) = 29 as 529 = 23^2 and 5'i is nonsquare for i<29, A071177(5)=23.
		

Crossrefs

Programs

  • Haskell
    import Data.List (findIndex)
    import Data.Maybe (fromJust)
    a071176 n = fromJust $ findIndex (== 1) $
                map (a010052 . read . (show n ++) . show) [0..]
    -- Reinhard Zumkeller, Aug 09 2011
    
  • Mathematica
    nksq[n_]:=Module[{idn=IntegerDigits[n],k=0},While[!IntegerQ[Sqrt[ FromDigits[Join[ idn,IntegerDigits[k]]]]],k++];k]; Array[nksq,70] (* Harvey P. Dale, Sep 28 2012 *)
  • PARI
    a(n)={if(issquare(10*n), 0, my(m=n, b=1); while(1, m*=10; my(r=(sqrtint(m+b-1)+1)^2-m); b*=10; if(rAndrew Howroyd, Jan 13 2023
    
  • Python
    from math import isqrt
    from sympy.ntheory.primetest import is_square
    def A071176(n):
        m = 10*n
        if is_square(m): return 0
        a = 1
        while (k:=(isqrt(a*(m+1)-1)+1)**2-m*a)>=10*a:
            a *= 10
        return k # Chai Wah Wu, Feb 15 2023

Formula

A000196(n . a(n)) = A071177(n) where "." stands for concatenation.

A243092 Least number k > n such that n concatenated with k produces a cube.

Original entry on oeis.org

25, 7, 43, 913, 12, 859, 29, 5184, 261, 648, 7649, 167, 31, 8877, 625, 6375, 28, 5193, 683, 5379, 97, 6981, 8328, 389, 15456, 2144, 44, 7496, 791, 48625, 4432, 768, 75, 3000, 937, 52264, 3248, 9017, 304, 96, 73281, 875, 8976, 10944, 6533, 656, 4552, 26809, 3039, 653, 2000, 68024
Offset: 1

Views

Author

Derek Orr, Aug 18 2014

Keywords

Comments

Differs from A245631 at n = 6, 12, 21, 34, 49, 51, 58, 68, 72, 92, ... - Chai Wah Wu, Feb 20 2023

Examples

			23 is not a cube. 24 is not a cube. 25 is not a cube. 26 is not a cube. 27 is a cube. Thus a(2) = 7.
		

Crossrefs

Cf. A245631.

Programs

  • Mathematica
    lnk[n_]:=Module[{k=n+1},While[!IntegerQ[Surd[n*10^IntegerLength[k]+k,3]],k++];k]; Array[lnk,60] (* Harvey P. Dale, Oct 14 2021 *)
  • PARI
    a(n)=s=Str(n);k=n+1; while(!(ispower(eval(concat(s, Str(k))), 3)), k++); return(k)
    vector(100, n, a(n))
    
  • Python
    from sympy import integer_nthroot
    def A243092(n):
        m, a = 10*n, 10**(len(str(n))-1)
        while (k:=(integer_nthroot(a*(m+1)-1,3)[0]+1)**3-m*a)>=10*a or k<=n:
            a *= 10
        return k # Chai Wah Wu, Feb 20 2023

Extensions

Improvement to PARI code by Colin Barker, Aug 18 2014

A245632 Least number k such that n concatenated with k is a perfect power.

Original entry on oeis.org

6, 5, 2, 9, 12, 4, 29, 1, 61, 0, 56, 1, 31, 4, 21, 9, 28, 49, 6, 25, 6, 5, 104, 3, 6, 244, 44, 9, 16, 25, 25, 4, 64, 3, 344, 1, 21, 44, 69, 0, 209, 25, 56, 1, 369, 24, 61, 4, 13, 41, 2, 9, 29, 76, 225, 25, 6, 32, 29, 84, 504, 5, 504, 516, 61, 564, 6, 59, 169, 56, 289, 9, 96, 529, 69, 176, 44, 4, 21, 656
Offset: 1

Views

Author

Derek Orr, Jul 27 2014

Keywords

Examples

			16 is the smallest perfect power > 9 beginning with 1. Thus a(1) = 6.
		

Crossrefs

Programs

  • Maple
    conc:= proc(n,k) if k = 0 then 10*n else 10^(1+ilog10(k))*n+k fi end proc:
    ispow:= proc(x) local F; F:= ifactors(x)[2];
    evalb(igcd(seq(f[2],f=F))>1) end proc:
    a:= proc(n) local k; for k from 0 do if ispow(conc(n,k)) then return k fi od end proc;
    seq(a(n),n=1..100); # Robert Israel, Jul 28 2014
  • PARI
    a(n)=p="";for(k=0,oo,p=concat(Str(n),Str(k));if(ispower(eval(p)),return(k)))
    n=1;while(n<100,print1(a(n),", ");n++)
    
  • Python
    from sympy import perfect_power
    def a(n):
        s, k = str(n), 0
        while not perfect_power(int(s+str(k))): k += 1
        return k
    print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Jun 05 2021

A246561 Least number k such that k concatenated with n is a cube, or 0 if no such k exists.

Original entry on oeis.org

133, 51, 34, 6, 12, 21, 2, 172, 72, 0, 3579, 5, 49, 0, 0, 2, 3890, 0, 593, 0, 689, 0, 1038, 138, 1, 0, 10927, 17, 7, 0, 13, 58, 4565, 0, 0, 973, 359, 0, 4930, 0, 5314, 0, 3, 27, 0, 0, 2500, 106, 1176, 0, 1326, 219, 506, 0, 0, 466, 8043, 0, 68, 0, 92, 0, 3007, 1574, 0, 0, 121, 327, 7049, 0, 7535, 548, 9126, 0, 33
Offset: 1

Views

Author

Derek Orr, Aug 29 2014

Keywords

Comments

a(n) = 0 if and only if n is in A246449.

Examples

			512 is the smallest cube ending with digit 2, so a(2) = 51.
		

Crossrefs

Programs

  • PARI
    b(n)=v=[];for(k=10^(n-1),10^n,v=concat(v,k^3%10^n));v=vecsort(v,,8);v
    w=[];for(k=1,250,d=digits(k);if(vecsearch(b(#d),k),w=concat(w,k)));w=vecsort(w,,8);w;
    a(n)=if(!vecsearch(w,n),return(0));if(vecsearch(w,n),j=1;s=Str(n);while(!ispower(eval(concat(Str(j),s)),3),j++);return(j))
    vector(200,n,a(n))
    
  • Python
    from sympy import nthroot_mod
    def A246561(n): return 0 if len(l:=nthroot_mod(n,3,(m:=10**(len(str(n)))))) == 0 else int((min(x for x in l+[d+m for d in l] if x**3>=m)**3-n)//m) # Chai Wah Wu, Feb 16 2023

Extensions

a(27), a(29) and a(43) corrected by Chai Wah Wu, Feb 16 2023

A360570 Numbers m such that m concatenated with k produces a cube for some 0 <= k <= m.

Original entry on oeis.org

6, 12, 21, 34, 49, 51, 58, 68, 72, 92, 100, 106, 121, 133, 138, 156, 172, 175, 195, 196, 219, 243, 262, 274, 297, 327, 337, 359, 373, 405, 409, 428, 466, 491, 506, 531, 548, 551, 583, 593, 614, 658, 681, 685, 689, 740, 753, 778, 800, 804, 830, 851, 857, 884
Offset: 1

Views

Author

Chai Wah Wu, Feb 20 2023

Keywords

Comments

Numbers k such that A243092(k) <> A245631(k).

Examples

			64 = 4^3 is a cube and 4 <= 6, thus 6 is a term.
343 = 7^3 is a cube and 3 <= 34, thus 34 is a term.
1000 = 10^3 is a cube and 0 <= 100, thus 100 is a term.
5359375 = 175^3 is a cube and 375 <= 5359, thus 5359 is a term.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local d,a,b,r,rmin,i;
      for d from 1 to ilog10(n)+1 do
        a:=ceil((10^d*n)^(1/3));
        b:= floor((10^d*(n+1))^(1/3));
     if d = 1 then rmin:= 0 else rmin:= 10^(d-1) fi;
        for i from a to b do
          r:= i^3 -10^d*n;
          if r >= min(10^d,n+1) then break fi;
          if r < rmin then next fi;
          return true
        od
      od;
      false
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Feb 22 2023
  • PARI
    is(n) = { for (k=0, n, if (ispower(n*10^max(1,#digits(k))+k, 3), return (1))); return (0) } \\ Rémy Sigrist, Feb 20 2023
  • Python
    from itertools import count, islice
    from sympy import integer_nthroot
    def A360570_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            if integer_nthroot(m:=10*n,3)[1]:
                yield n
            else:
                a = 1
                while (k:=(integer_nthroot(a*(m+1)-1,3)[0]+1)**3-m*a)>=10*a:
                    a *= 10
                    if a > n:
                        break
                else:
                    if k <= n:
                        yield n
    A360570_list = list(islice(A360570_gen(),20))
    
Showing 1-5 of 5 results.