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.

A378119 a(n) is the smallest positive k such that the digit sums of k and k + 1 are both divisible by n, or -1 if no such pair exists.

Original entry on oeis.org

1, 19, -1, 39, 49999, -1, 69999, 79, -1, 18999999999, 2899999, -1, 48999, 5899999999999, -1, 78999999999, 8899, -1, 19899999999999999999, 298999999999, -1, 49899999, 598999999999999999999, -1, 79899999999999999, 898999, -1, 19989999999999999999999999999, 29989999999999999, -1
Offset: 1

Views

Author

Barney Maunder-Taylor, Nov 16 2024

Keywords

Comments

It is clear that a(n) must be -1 if n is a multiple of three since if we assume (hoping for a contradiction) that there exist k, k+1 both of which have digit sums that are multiples of 3, then k and k+1 must themselves both be divisible by 3, a contradiction.

Examples

			a(2) = 19 because both 19 and 20 have digit sums that are multiples of 2: 1+9 = 10 = 5*2 and 2+0 = 2 = 1*2, it is easily checked (by exhaustion) that there is no smaller pair of consecutive integers with this property.
		

Crossrefs

Programs

  • Python
    def A378119(n):
        if n == 1:
            return 1
        elif n % 3 == 0:
            return -1
        else:
            return (((n%9)+1)*10**(n//9)-1)*(10**pow(9,-1,n))-1
    # Colin Beveridge, Dec 13 2024

Formula

a(n) = A051885(n) * 10^q - 1, where q is 9^(-1) (mod n) for n > 1 and n not a multiple of 3 (see linked proof). - Colin Beveridge, Dec 16 2024