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.

User: Sharvil Kesarwani

Sharvil Kesarwani's wiki page.

Sharvil Kesarwani has authored 2 sequences.

A355884 Number of circles in an n X n grid passing through at least three points.

Original entry on oeis.org

0, 0, 1, 34, 223, 997, 3402, 9141, 21665, 46390, 90874, 167539, 293443, 487082, 781537, 1209469, 1816528, 2661113, 3822203, 5369662, 7420495, 10086360, 13494376
Offset: 0

Author

Sharvil Kesarwani, Jul 20 2022

Keywords

Crossrefs

Programs

  • PARI
    \\ after user joriki's Java code at Mathematics Stack Exchange link
    circles(n) = {
      my(C = List());
      for (x1 = 1, n,
        for (y1 = 1, n,
          for (x2 = 1, x1,
            for (y2 = 1, n,
              for (x3 = 1, x2,
                for (y3 = 1, n,
                    my( ax2 = 2 * (x2 - x1),
                      ay2 = 2 * (y2 - y1),
                      ax3 = 2 * (x3 - x1),
                      ay3 = 2 * (y3 - y1),
                      den = ax2 * ay3 - ax3 * ay2
                    );
                  if (den == 0, next);
                    my( b2 = x2^2 + y2^2 - x1^2 - y1^2,
                      b3 = x3^2 + y3^2 - x1^2 - y1^2,
                      x = b2 * ay3 - b3 * ay2,
                      y = ax2 * b3 - ax3 * b2,
                      gc = gcd(gcd(x, y), den)
                    );
                  if (den < 0, gc = -gc);
                    x /= gc; y /= gc; den /= gc;
                    my( dx = x - den * x1,
                      dy = y - den * y1,
                      s = dx^2 + dy^2
                    );
                  listput(C, [x, y, s, den])
      ))))));
      Set(C)
    };
    for (k = 0, 10, print1(#circles(k), ", "))  \\ Hugo Pfoertner, Sep 22 2022

A282473 Multiples of 9 which cannot be expressed as the difference between a natural number k and its digit sum s(k).

Original entry on oeis.org

90, 189, 288, 387, 486, 585, 684, 783, 882, 981, 990, 1089, 1188, 1287, 1386, 1485, 1584, 1683, 1782, 1881, 1980, 1989, 2088, 2187, 2286, 2385, 2484, 2583, 2682, 2781, 2880, 2979, 2988, 3087, 3186, 3285, 3384, 3483, 3582, 3681, 3780, 3879, 3978, 3987, 4086, 4185, 4284, 4383, 4482, 4581, 4680, 4779, 4878, 4977, 4986
Offset: 1

Author

Sharvil Kesarwani, Feb 16 2017

Keywords

Comments

Based on empirical observations, it can be noted that the difference between consecutive terms is usually 99. However, this breaks down when the hundreds digit is 9, in which case the difference between consecutive terms is 9. This changes back, however.

Examples

			If k=90, then k-s(k)=81. If k=100, then k-s(k)=99. This is an increasing function, so k-s(k)=90 is unachievable.
		

Crossrefs

Programs

  • Mathematica
    okQ[n_] := Catch[ Do[ If[ x- Total@ IntegerDigits@ x == n, Throw@ False], {x, n, n+ 9 IntegerLength[n]}]; True]; Select[9 Range[1000], okQ[#] &] (* Giovanni Resta, Feb 27 2017 *)
  • PARI
    is(n)=for(k=n,n+9*#Str(n)+9, if(k-sumdigits(k)==n, return(0))); n%9==0 \\ Charles R Greathouse IV, Feb 27 2017
  • Python
    from math import ceil
    def a(n): #Outputs all numbers less than n which are in the sequence
        def s(n):
            r = 0
            while n:
                r, n = r + n% 10, n//10
            return r
        mult9=[]
        if n%9==0:
            for x in range(1, ceil(n/9)+1):
                mult9.append(9*x)
        else:
            for x in range(1, ceil(n/9)):
                mult9.append(9*x)
        for y in range(1, ceil(n/10)+1):
            mult9.remove(10*y-s(10*y))
        return mult9