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.

A000030 Initial digit of n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

When n - a(n)*10^[log_10 n] >= 10^[(log_10 n) - 1], where [] denotes floor, or when n < 100 and 10|n, n is the concatenation of a(n) and A217657(n). - Reinhard Zumkeller, Oct 10 2012, improved by M. F. Hasler, Nov 17 2018, and corrected by Glen Whitney, Jul 01 2022
Equivalent definition: The initial a(0) = 0 is followed by each digit in S = {1,...,9} once. Thereafter, repeat 10 times each digit in S. Then, repeat 100 times each digit in S, etc.

Examples

			23 begins with a 2, so a(23) = 2.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a000030 = until (< 10) (`div` 10) -- Reinhard Zumkeller, Feb 20 2012, Feb 11 2011
    
  • Magma
    [Intseq(n)[#Intseq(n)]: n in [1..100]]; // Vincenzo Librandi, Nov 17 2018
    
  • Maple
    A000030 := proc(n)
        if n = 0 then
            0;
        else
            convert(n,base,10) ;
            %[-1] ;
        end if;
    end proc:
    seq(A000030(n),n=0..200) ;# N. J. A. Sloane, Feb 10 2017
  • Mathematica
    Join[{0},First[IntegerDigits[#]]&/@Range[90]] (* Harvey P. Dale, Mar 01 2011 *)
    Table[Floor[n/10^(Floor[Log10[n]])], {n, 1, 50}] (* G. C. Greubel, May 16 2017 *)
    Table[NumberDigit[n,IntegerLength[n]-1],{n,0,100}] (* Harvey P. Dale, Aug 29 2021 *)
  • PARI
    a(n)=if(n<10,n,a(n\10)) \\ Mainly for illustration.
    
  • PARI
    A000030(n)=n\10^logint(n+!n,10) \\ Twice as fast as a(n)=digits(n)[1]. Before digits() was added in PARI v.2.6.0 (2013), one could use, e.g., Vecsmall(Str(n))[1]-48. - M. F. Hasler, Nov 17 2018
    
  • Python
    def a(n): return int(str(n)[0])
    print([a(n) for n in range(85)]) # Michael S. Branicky, Jul 01 2022

Formula

a(n) = [n / 10^([log_10(n)])] where [] denotes floor and log_10(n) is the logarithm is base 10. - Dan Fux (dan.fux(AT)OpenGaia.com or danfux(AT)OpenGaia.com), Apr 07 2001
a(n) = k for k*10^j <= n < (k+1)*10^j for some j. - M. F. Hasler, Mar 23 2015

A002993 Initial digits of squares.

Original entry on oeis.org

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

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

Formula

a(n) = A000030(A000290(n)). - Reinhard Zumkeller, Aug 17 2008

A086457 Both n and n^2 have the same initial digit and also n and n^2 have the same final digit when expressed in base 10.

Original entry on oeis.org

0, 1, 10, 11, 95, 96, 100, 101, 105, 106, 110, 111, 115, 116, 120, 121, 125, 126, 130, 131, 135, 136, 140, 141, 895, 896, 950, 951, 955, 956, 960, 961, 965, 966, 970, 971, 975, 976, 980, 981, 985, 986, 990, 991, 995, 996, 1000, 1001, 1005, 1006, 1010, 1011
Offset: 1

Views

Author

Jeremy Gardiner, Jul 20 2003

Keywords

Comments

All terms of A045953 appear in this sequence.
Subsequence of A008851; A045953 and A046851 are subsequences. [Reinhard Zumkeller, Jul 27 2011]
Intersection of A008851 and A089951. - Michel Marcus, Mar 19 2015

Examples

			a(12) = 115 appears in the sequence because 115*115 = 13225.
		

Crossrefs

Programs

  • BASIC
    left$(str$(n), 1) = left$(str$(n^2), 1) AND right$(str$(n), 1) = right$(str$(n^2), 1)
    
  • Haskell
    a086457 n = a086457_list !! (n-1)
    a086457_list = filter (\x -> a000030 x == a000030 (x^2) &&
                                 a010879 x == a010879 (x^2)) [0..]
    -- Reinhard Zumkeller, Jul 27 2011
  • Mathematica
    ldQ[n_]:=Module[{idn=IntegerDigits[n],idn2=IntegerDigits[n^2]}, First[ idn] == First[idn2]&&Last[idn]==Last[idn2]]; Select[Range[ 0,1100], ldQ]  (* Harvey P. Dale, Feb 06 2011 *)

Formula

A000030(a(n)) = A000030(a(n)^2) and A010879(a(n)) = A010879(a(n)^2).

Extensions

Offset corrected by Reinhard Zumkeller, Jul 27 2011

A144582 Numbers having the same leading decimal digit as their cube.

Original entry on oeis.org

0, 1, 10, 11, 12, 28, 29, 32, 33, 34, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 17 2008

Keywords

Comments

For k > 0, write k = s * 10^t, 1 <= s < 10, then k is a term if and only if s is in [1, 2^(1/3)) U (20^(1/3), 3) U (30^(1/3), 40^(1/3)) U (30^(2/3), 10). - Jianing Song, Dec 26 2022

Examples

			a(13)=99 and 970299=99^3 start both with 9.
		

Crossrefs

Cf. A000030, A002994, A000578, A089951, A256523 (subsequence).

Programs

  • Haskell
    a144582 n = a144582_list !! (n-1)
    a144582_list = [x | x <- [0..], a000030 x == a000030 (x ^ 3)]
    -- Reinhard Zumkeller, Apr 01 2015
  • Mathematica
    Select[Range[0,300],First[IntegerDigits[#]]== First[IntegerDigits[#^3]]&]  (* Harvey P. Dale, Mar 14 2011 *)
  • PARI
    isok(n) = (n == 0) || (digits(n)[1] == digits(n^3)[1]); \\ Michel Marcus, Mar 18 2015
    

Formula

A000030(a(n)) = A002994(a(n)) = A000030(A000578(a(n))).

A256523 Numbers m such that m, m^2 and m^3 have identical initial digits in decimal representation.

Original entry on oeis.org

0, 1, 10, 11, 12, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 01 2015

Keywords

Comments

Intersection of A089951 and A144582.
From Jianing Song, Dec 26 2022: (Start)
For k > 0, write k = s * 10^t, 1 <= s < 10, then k is a term if and only if s is in [1, 2^(1/3)) U (30^(2/3), 10).
Except for 0, terms of A144582 that start with 1 or 9. (End)

Crossrefs

Programs

  • Haskell
    a256523 n = a256523_list !! (n-1)
    a256523_list = [x | x <- [0..], let i = a000030 x,
                        a000030 (x ^ 2) == i, a000030 (x ^ 3) == i]
    
  • Mathematica
    Select[Range[0,1000],Length[Union[(IntegerDigits/@(#^Range[3]))[[;;,1]]]]==1&] (* Harvey P. Dale, Dec 17 2024 *)
  • PARI
    initial(n)=digits(n)[1]
    is(n)=if(n==0, return(1)); my(k=initial(n)); initial(n^2)==k && initial(n^3)==k \\ Charles R Greathouse IV, May 13 2015

Formula

A000030(a(n)) = A002993(a(n)) = A000030(A000290(a(n))) = A002994(a(n)) = A000030(A000578(a(n))).
Showing 1-5 of 5 results.