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 12 results. Next

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

A367360 Comma transform of squares.

Original entry on oeis.org

1, 14, 49, 91, 62, 53, 64, 96, 48, 11, 1, 11, 41, 91, 62, 52, 62, 93, 43, 14, 4, 14, 45, 95, 66, 56, 67, 97, 48, 19, 9, 11, 41, 91, 61, 51, 61, 91, 41, 11, 1, 11, 41, 91, 62, 52, 62, 92, 42, 12, 2, 12, 42, 92, 63, 53, 63, 93, 43, 13, 3, 13, 43, 94, 64, 54, 64, 94, 44, 14, 5, 15, 45, 95, 65, 55, 65, 96, 46, 16, 6, 16, 46, 97
Offset: 0

Views

Author

N. J. A. Sloane, Nov 22 2023

Keywords

Comments

To compute the comma transform of a sequence [b,c,d,e,f,...], concatenate the last digit of each term with the first digit of the following term. In other words, these are the numbers formed by the pairs of digits that surround the commas that separate the terms of the original sequence.
The comma transform CT(S) of a sequence S of positive numbers maps S into the set F consisting of finite or infinite sequences of positive numbers each with one or two digits. The inverse comma transform CTi maps an element of F to an element of F.
Inspired by Eric Angelini's A121805.

Examples

			The squares are 0, 1, 4, 9, 16, 25, ..., so the comma transform is [0]1, 14, 49, 91, 62, ...
		

Crossrefs

A166499 is the comma transform of the primes, A367361 of the powers of 2, A367362 of the nonnegative integers. See also A368362.

Programs

  • Maple
    Maple code for comma transform (CT(a)) of a sequence a:
    # leading digit, from A000030
    Ldigit:=proc(n) local v; v:=convert(n, base, 10); v[-1]; end;
    CT:=proc(a) local b,i; b:=[];
    for i from 1 to nops(a)-1 do
    b := [op(b), 10*(a[i] mod 10) + Ldigit(a[i+1])]; od: b; end;
    # Inverse comma transform of sequence A calculated in base "bas": - N. J. A. Sloane, Jan 03 2024
    bas := 10;
    Ldigit:=proc(n) local v; v:=convert(n, base, bas); v[-1]; end;
    CTi := proc(A) local B,i,L,R;
    for i from 1 to nops(A) do
       if A[i]>=bas^2 then error("all terms must have 1 or 2 digits"); fi; od:
    B:=Array(1..nops(A),-1);
    if A[1] >= bas then B[1]:= Ldigit(A[1]); L:=(A[1] mod bas);
    else B[1]:=10; L:=A[1];
    fi;
    for i from 2 to nops(A) do
      if A[i] >= bas then R := Ldigit(A[i]) else R:=0; fi;
      B[i] := L*bas + R;
      L := (A[i] mod bas);
    od;
    B;
    end;
    # second Maple program:
    a:= n-> parse(cat(""||(n^2)[-1],""||((n+1)^2)[1])):
    seq(a(n), n=0..99);  # Alois P. Heinz, Nov 22 2023
  • Mathematica
    a[n_]:=FromDigits[{Last[IntegerDigits[n^2]],First[IntegerDigits[(n+1)^2]]}];
    a/@Range[0,83] (* Ivan N. Ianakiev, Nov 24 2023 *)
  • Python
    from itertools import count, islice, pairwise
    def S(): yield from (str(i**2) for i in count(0))
    def agen(): yield from (int(t[-1]+u[0]) for t, u in pairwise(S()))
    print(list(islice(agen(), 84))) # Michael S. Branicky, Nov 22 2023
    
  • Python
    def A367360(n): return (0, 10, 40, 90, 60, 50, 60, 90, 40, 10)[n%10]+int(str((n+1)**2)[0]) # Chai Wah Wu, Dec 22 2023

Formula

a(n) = 10 * A008959(n) + A002993(n+1). - Alois P. Heinz, Nov 22 2023

A002994 Initial digit of cubes.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

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

References

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

Crossrefs

Programs

A097408 Initial decimal digit of n^4.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Aug 16 2004

Keywords

Examples

			1, 16, 81, 256, 625, 1296, 2401, 4096, 6561, 10000, ...
		

Crossrefs

Programs

  • Maple
    a:= n-> parse(""||(n^4)[1]):
    seq(a(n), n=1..120);  # Alois P. Heinz, Jan 28 2016

A097409 Initial decimal digit of n^5.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Aug 16 2004

Keywords

Examples

			1, 32, 243, 1024, 3125, 7776, 16807, 32768, 59049, 100000, ...
		

Crossrefs

Programs

  • Maple
    a:= n-> parse(""||(n^5)[1]):
    seq(a(n), n=1..120);  # Alois P. Heinz, Jan 28 2016

A097413 Initial decimal digit of n^9.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Aug 16 2004

Keywords

Examples

			1, 512, 19683, 262144, 1953125, 10077696, 40353607, 134217728, 387420489, 1000000000, ...
		

Crossrefs

Programs

  • Maple
    idd:= n -> floor(n/10^ilog10(n)):
    seq(idd(n^9),n=2..100); # Robert Israel, Jan 28 2016
  • Mathematica
    Table[IntegerDigits[n^9][[1]],{n,120}] (* Harvey P. Dale, Aug 25 2023 *)

Formula

a(n) = A000030(n^9) = floor(n^9/10^A004216(n^9)). - Robert Israel, Jan 28 2016

A089951 Numbers having the same leading decimal digits as their squares.

Original entry on oeis.org

0, 1, 10, 11, 12, 13, 14, 95, 96, 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, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 895
Offset: 1

Views

Author

Reinhard Zumkeller, Jan 12 2004

Keywords

Comments

A000030(a(n)) = A002993(a(n)) = A000030(A000290(a(n))).

Examples

			895*895 = 801025, therefore 895 is a term: a(55)=895.
		

Crossrefs

Cf. A018834.
Cf. A144582. - Reinhard Zumkeller, Aug 17 2008
Cf. A000030, A002993, A000290, A256523 (subsequence).

Programs

  • Haskell
    a089951 n = a089951_list !! (n-1)
    a089951_list = [x | x <- [0..], a000030 x == a000030 (x ^ 2)]
    -- Reinhard Zumkeller, Apr 01 2015
  • Maple
    F:= proc(d) $10^d .. floor(sqrt(2)*10^d), $ ceil(sqrt(80)*10^d) .. 9*10^d - 1, $ ceil(sqrt(90)*10^d) .. 10^(d+1)-1 end proc:
    0, F(0), F(1), F(2), F(3); # Robert Israel, Mar 18 2015
  • Mathematica
    d[n_] := IntegerDigits[n]; Select[Range[895],
    First[d[#]] == First[d[#^2]] &] (* Jayanta Basu, Jun 03 2013 *)
  • PARI
    a(n)={my(v = [1, sqrt(80), sqrt(90)], w=[(k)->10^k * ((sqrt(2) - 1))\1 + 1, (k)->9 * 10^k - ceil(sqrt(80) * 10^k), (k)->10 * 10^k - ceil(sqrt(90) * 10^k)],i = 1,k = 0); if(n==1, 0, n--; while(n>w[i](k), n-=w[i](k); i++; if(i == 4, i = 1; k++)); ceil(v[i]*10^k)+n-1)} \\ David A. Corneth, Feb 26 2015
    
  • PARI
    isok(n) = (n == 0) || (digits(n)[1] == digits(n^2)[1]); \\ Michel Marcus, Mar 18 2015
    

Formula

A number n is in the sequence iff n = 0 or n/10^floor(log_10(n)) lies in one of the half-open intervals [1, sqrt(2)), [sqrt(80), 9) or [sqrt(90), 10). - David W. Wilson, May 29 2008

A097410 Initial decimal digit of n^6.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Aug 16 2004

Keywords

Examples

			1, 64, 729, 4096, 15625, 46656, 117649, 262144, 531441, 1000000, ...
		

Crossrefs

Programs

  • Mathematica
    IntegerDigits[#][[1]]&/@(Range[110]^6) (* Harvey P. Dale, Mar 23 2018 *)

Extensions

One prepended by Harvey P. Dale, Mar 23 2018

A097411 Initial decimal digit of n^7.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Aug 16 2004

Keywords

Examples

			1, 128, 2187, 16384, 78125, 279936, 823543, 2097152, 4782969, 10000000, ...
		

Crossrefs

Programs

  • Mathematica
    Table[First[IntegerDigits[n^7]],{n,110}] (* Harvey P. Dale, Mar 17 2019 *)

Extensions

1 prepended by Harvey P. Dale, Mar 17 2019

A097412 Initial decimal digit of n^8.

Original entry on oeis.org

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

Views

Author

Eric W. Weisstein, Aug 16 2004

Keywords

Examples

			1, 256, 6561, 65536, 390625, 1679616, 5764801, 16777216, 43046721, 100000000, ...
		

Crossrefs

Extensions

a(0) and a(1) added by Neven Juric, Sep 23 2010
Showing 1-10 of 12 results. Next