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

A227218 Smallest triangular number ending in n ones.

Original entry on oeis.org

1, 1711, 105111, 6271111, 664611111, 222222111111, 22222221111111, 2222222211111111, 2517912111111111, 18428299161111111111, 2222222222211111111111, 222222222222111111111111, 22222222222221111111111111, 1090161504430911111111111111
Offset: 1

Views

Author

Shyam Sunder Gupta, Sep 19 2013

Keywords

Comments

If a triangular number ends in like digits then it can only end in 0's, 1's, 5's or 6's.
The sequence is infinite because the sequence of triangular numbers 21, 2211, 222111, 22221111, ... (A319170) is infinite.

Examples

			a(2) = 1711 because 1711 is the smallest triangular number ending in  2 '1's.
		

Crossrefs

Programs

  • Mathematica
    t = {}; Do[Do[x = n*(n + 1)/2;If[Mod[x, 10^m] == (10^m - 1)/9, AppendTo[t, x]; Break[]], {n, 1, 10^m}], {m, 1, 10}]; t
    a[n_] := Block[{x, y, s}, s = y /. List@ ToRules[ Reduce[(y+1)* y/2 == x*10^n +(10^n - 1)/9 && y > 0 && x >= 0, {y, x}, Integers] /. C[1] -> 0]; Min[s*(s + 1)/2]]; Array[a, 20] (* Giovanni Resta, Sep 20 2013 *)
  • Python
    from sympy import sqrt_mod_iter
    def A227218(n):
        k, a = 10**n<<1, (10**n-1)//9<<1
        m = (a<<2)+1
        return min(b for b in ((d>>1)*((d>>1)+1) for d in sqrt_mod_iter(m, k) if d&1) if b%k==a)>>1 # Chai Wah Wu, May 04 2024

Extensions

a(11)-a(14) from Giovanni Resta, Sep 20 2013

A227220 Smallest triangular number ending in n 6's.

Original entry on oeis.org

6, 66, 666, 8146666, 2340066666, 109704666666, 15212926666666, 66488766666666, 173147535666666666, 11302559226666666666, 14642337066666666666, 77850029701666666666666, 1029964845546666666666666, 3086210323568466666666666666, 4014564887872666666666666666
Offset: 1

Views

Author

Shyam Sunder Gupta, Sep 19 2013

Keywords

Comments

If a triangular number ends in like digits then it can only end in 0's, 1's, 5's or 6's.

Examples

			a(4)=8146666 because 8146666 is the smallest triangular number ending in  4 '6's.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local k;
       k:=min(map(rhs@op, [msolve(k*(k+1)=4/3*(10^n-1),2*10^n)]));
       k*(k+1)/2
    end proc:
    map(f, [$1..30]); # Robert Israel, Sep 04 2019
  • Mathematica
    t = {}; Do[Do[x = n*(n + 1)/2;If[Mod[x, 10^m] == 6*(10^m - 1)/9, AppendTo[t, x]; Break[]], {n, 1, 10^m}], {m, 1, 10}]; t
    a[n_] := Block[{x,y,s}, s = y /. List@ ToRules[ Reduce[(y+1)* y/2 == x*10^n + 2(10^n - 1)/3 && y > 0 && x >= 0, {y, x}, Integers] /. C[1] -> 0]; Min[s*(s + 1)/2]]; Array[a,20] (* Giovanni Resta, Sep 20 2013 *)
  • Python
    from sympy import sqrt_mod_iter
    def A227220(n):
        k, a = 10**n<<1, (10**n-1)//3<<2
        m = (a<<2)+1
        return min(b for b in ((d>>1)*((d>>1)+1) for d in sqrt_mod_iter(m, k) if d&1) if b%k==a)>>1 # Chai Wah Wu, May 04 2024

Extensions

a(11)-a(15) from Giovanni Resta, Sep 20 2013
Showing 1-2 of 2 results.