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.

A258682 Remove from n^2 all digits of n from left to right, in decimal representation.

Original entry on oeis.org

0, 0, 4, 9, 16, 2, 3, 49, 64, 81, 0, 2, 44, 69, 96, 22, 25, 289, 324, 36, 40, 44, 484, 59, 576, 6, 76, 9, 74, 841, 90, 96, 104, 1089, 1156, 122, 129, 169, 1444, 1521, 160, 681, 176, 189, 1936, 202, 211, 2209, 230, 201, 20, 260, 704, 2809, 2916, 302, 313
Offset: 0

Views

Author

Reinhard Zumkeller, Jun 07 2015

Keywords

Comments

a(A029783(n)) = A029783(n)^2; a(A189056(n)) < A189056(n)^2;
a(A178501(n)) = 0.

Examples

			.    n   n^2 |  a(n)
. -----------+------
.   20   400 |    40
.   21   441 |    44
.   22   484 |   484
.   23   529 |    59
.   24   576 |   576
.   25   625 |     6
.   26   676 |    76  not 67, as digits of n are to be removed
.   27   729 |     9                                  from left to right
.   28   784 |    74
.   29   841 |   841
.   30   900 |    90  .
		

Crossrefs

Programs

  • Haskell
    import Data.List (delete)
    a258682 n = read ('0' : minus (show (n ^ 2)) (show n)) :: Int  where
       minus [] _  = []
       minus us [] = us
       minus (u:us) vs | elem u vs = minus us $ delete u vs
                       | otherwise = u : minus us vs
  • Mathematica
    a[n_]:=Module[{idn=IntegerDigits[n],idnn=IntegerDigits[n^2],idn1},
    idn1=DeleteCases[idn,m_/;MemberQ[Complement[idn,idnn],m]];
    Do[If[First[Position[idnn,idn1[[i]]]]!= {},idnn=Delete[idnn,First[Position[idnn,idn1[[i]]]]]],
    {i,1,Length[idn1]}];FromDigits[idnn]]//Quiet;
    a/@Range[0,56] (* Ivan N. Ianakiev, Jun 11 2015 *)