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: Stuart Coe

Stuart Coe's wiki page.

Stuart Coe has authored 6 sequences.

A378513 a(1) = 1, a(n) = a(n-1) + n if all the digits of a(n-1) do not share a divisor greater than 1. Otherwise, a(n) = a(n-1) divided by the gcd of all its individual digits.

Original entry on oeis.org

1, 3, 1, 5, 1, 7, 1, 9, 1, 11, 22, 11, 24, 12, 27, 43, 60, 10, 29, 49, 70, 10, 33, 11, 36, 12, 39, 13, 42, 21, 52, 84, 21, 55, 11, 47, 84, 21, 60, 10, 51, 93, 31, 75, 120, 166, 213, 261, 310, 360, 120, 172, 225, 279, 334, 390, 130, 188, 247, 307, 368, 430
Offset: 1

Author

Stuart Coe, Nov 29 2024

Keywords

Comments

It can be shown that this sequence will grow indefinitely: Once it has reached a given number of digits in length, it cannot drop below that number of digits. Regardless of the number of times the number is reduced by dividing by GCDs, n will inevitably be great enough to increase a(n) to a larger and larger number of digits in length.

Examples

			a(37) = 47 + 37, because the digits of 47 do not share a factor greater than 1.
a(38) = 84 / 4 = 21, because the gcd of 8 and 4 is 4.
		

Crossrefs

Cf. A052423 (gcd of digits).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=1, 1, (t-> (g->
          `if`(g=1, t+n, t/g))(igcd(convert(t, base, 10)[])))(a(n-1)))
        end:
    seq(a(n), n=1..62);  # Alois P. Heinz, Nov 29 2024
  • Mathematica
    Module[{n = 1, g}, NestList[If[n++; (g = GCD @@ IntegerDigits[#]) == 1, # + n, #/g] &, 1, 100]] (* Paolo Xausa, Dec 16 2024 *)
  • PARI
    lista(nn) = my(v=vector(nn)); v[1] = 1; for (n=2, nn, my(g=gcd(digits(v[n-1]))); if (g == 1, v[n] = v[n-1]+n, v[n] = v[n-1]/g);); v; \\ Michel Marcus, Dec 09 2024

A378505 a(0) = 0, a(n) = 0 where a(n-1) is nonzero and divisible by n. Otherwise a(n) = n + a(n-1).

Original entry on oeis.org

0, 1, 3, 0, 4, 9, 15, 22, 30, 39, 49, 60, 0, 13, 27, 42, 58, 75, 93, 112, 132, 153, 175, 198, 222, 247, 273, 300, 328, 357, 387, 418, 450, 483, 517, 552, 588, 625, 663, 0, 40, 81, 123, 166, 210, 255, 301, 348, 396, 445, 495, 546, 598, 651, 705, 760, 816
Offset: 0

Author

Stuart Coe, Nov 29 2024

Keywords

Comments

From Robert Israel, Nov 29 2024: (Start)
There are an infinite number of zeros in the sequence. If not, suppose a(m) was the last one. Then for j > m, we would have a(j-1) = (m+1) + (m+2) + ... + (j-1) = (j+m)*(j-m-1)/2. In particular, a(m*(m+1)-1) = (m-1)*m*(m+1)*(m+2)/2, which is divisible by m*(m+1) since m-1 or m+2 is even, and that would mean a(m*(m+1)) = 0, contradiction. (End)
From David A. Corneth, Nov 30 2024: (Start)
For some z_0 > 0 such that a(z_0) = 0 we can find the next z_1 > z_0 such that a(z_1) = 0 but for any z_0 < t < z_1 we have a(t) > 0. Then a(t) = binomial(t+1, 2) - binomial(z0+1, 2). Since a(z_1) = 0 we have z_1 | (binomial(z_1 -1 +1, 2) - binomial(z0+1, 2)) = z_1 * (z_1 - 1) / 2 - z_0 * (z_0 + 1)/2.
This means z_1 | 2*(z_1 * (z_1 - 1) / 2 - z_0 * (z_0 + 1)/2) = (z_1 * (z_1 - 1) - z_0 * (z_0 + 1)) where (z_1 * (z_1 - 1) - z_0 * (z_0 + 1)) > 0. As z_1 | z_1 * (z_1 - 1) we also have z_1 | (z_0 * (z_0 + 1)). By the proof of Robert Israel above such z_1 must exist. (End)

Examples

			a(11) = 49 + 11 = 60, since a(10) = 49, which does not exactly divide by 11.
a(12) = 0, since a(11) = 60, a nonzero number that exactly divides by 12.
a(13) = 0 + 13 = 13, since a(12) = 0 (so is not nonzero).
From _David A. Corneth_, Nov 30 2024: (Start)
The next 0 after n = 12 is a divisor of 12 * (12 + 1) = 156. The divisors of 156 that are larger than 12 + 1 = 13 are 26, 39, 52, 78, 156. Of these, 39 is the smallest z_1 such that z_1 | z_1 * (z_1 - 1) / 2 - z_0 * (z_0 + 1)/2. Therefore the next 0 after n = 12 is at n = 39.
The first few zeros are at 0, 3, 12, 39, 65, 78, 158, 237, ... (= A379013). As 100 is between the consecutive zeros 78 and 158 there is no zero strictly between 78 and 158 and so a(100) = 100*(100+1) / 2 - 78*(78+1)/2 = 1969. (End)
		

Crossrefs

Cf. A068627, A379013 (positions of zeros).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0, (t->
         `if`(t>0 and irem(t,n)=0, 0, t+n))(a(n-1)))
        end:
    seq(a(n), n=0..56);  # Alois P. Heinz, Nov 29 2024
  • Mathematica
    Module[{n = 0}, NestList[If[Divisible[#, ++n] && # > 0, 0, # + n] &, 0, 100]] (* Paolo Xausa, Dec 09 2024 *)
  • PARI
    \\ See Corneth link
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        an = 0
        for n in count(1):
            yield an
            an = 0 if an > 0 and an%n == 0 else an + n
    print(list(islice(agen(), 70))) # Michael S. Branicky, Nov 29 2024
    

A376930 a(0)=0, a(1)=1; for n>1, a(n) = a(n-1)+a(n-2), except where a(n-1) is a prime greater than 2, in which case a(n) = a(n-1)-a(n-2).

Original entry on oeis.org

0, 1, 1, 2, 3, 1, 4, 5, 1, 6, 7, 1, 8, 9, 17, 8, 25, 33, 58, 91, 149, 58, 207, 265, 472, 737, 1209, 1946, 3155, 5101, 1946, 7047, 8993, 16040, 25033, 8993, 34026, 43019, 8993, 52012, 61005, 113017, 52012, 165029, 217041, 382070, 599111, 981181, 1580292, 2561473
Offset: 0

Author

Stuart Coe, Oct 11 2024

Keywords

Comments

It is not clear whether this sequence continues to grow or whether it become stuck in a loop (which could happen if two primes occur in terms n and n-1 or terms n and n-2). Indeed, the sequence is stuck in a loop from around n=10 if we do not ignore the prime number 2.
Similarly, it is not known if the sequence contains any negative terms (which may happen if two primes are adjacent or separated by one other term).
If it continues to grow, it is not clear whether this sequence will contain an infinite number of prime numbers.
Beyond the trivial case of 1, it is not clear if any number will appear more than three times in the sequence. 8993 appears three times, due to several prime terms in close succession.
Also 4618239875200356592 appears three times, as a(111), a(114) and a(117). - Robert Israel, Nov 12 2024

Examples

			a(2) = a(1) + a(0) [as a(1) is not a prime > 2] = 1 + 0 = 1.
a(3) = a(2) + a(1) [as a(2) is not a prime > 2] = 1 + 1 = 2.
a(4) = a(3) + a(2) [as a(3) is not a prime > 2] = 2 + 1 = 3.
a(5) = a(4) - a(3) [as a(4) is a prime > 2]     = 3 - 2 = 1.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) option remember;
          if procname(n-1) > 2 and isprime(procname(n-1)) then procname(n-1) - procname(n-2)
          else procname(n-1) + procname(n-2)
          fi
    end proc:
    f(0):= 0: f(1):= 1:
    seq(f(i),i=0..100); # Robert Israel, Nov 12 2024
  • Mathematica
    s={0,1};Do[If[PrimeQ[s[[-1]]]&&s[[-1]]>2,AppendTo[s,s[[-1]]-s[[-2]]],AppendTo[s,s[[-1]]+s[[-2]]]  ],{n,48}];s (* James C. McMahon, Nov 07 2024 *)
  • Python
    from sympy import isprime
    from itertools import islice
    def agen(): # generator of terms
        a = [0, 1]
        yield from a
        while True:
            an = a[-1]+a[-2] if a[-1] < 3 or not isprime(a[-1]) else a[-1]-a[-2]
            yield an
            a = [a[-1], an]
    print(list(islice(agen(), 50))) # Michael S. Branicky, Oct 11 2024

A376257 a(n) = (n - c(n))*(-1)^c(n), where c(n) is the product of the digits of n (A007954).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 10, -10, 10, -10, 10, -10, 10, -10, 10, -10, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 30, -28, 26, -24, 22, -20, 18, -16, 14, -12, 40, 37, 34, 31, 28, 25, 22, 19, 16, 13, 50, -46, 42, -38, 34, -30, 26, -22, 18, -14, 60, 55, 50, 45, 40, 35, 30, 25, 20, 15, 70, -64, 58
Offset: 1

Author

Stuart Coe, Sep 17 2024

Keywords

Comments

There is an interesting pattern on the graph of the sequence.

Examples

			For n = 129: 1*2*9=18. So a(n) = (129-18)*(-1)^18 = 111.
		

Crossrefs

Programs

  • Mathematica
    A376257[n_] := (n - #)*(-1)^# & [Times @@ IntegerDigits[n]];
    Array[A376257, 100] (* Paolo Xausa, Dec 10 2024 *)

Formula

a(n) = (n-A007954(n)) * (-1)^A007954(n).

A376129 Run lengths of the most significant decimal digit in the primes (A077648).

Original entry on oeis.org

1, 1, 1, 1, 4, 2, 2, 3, 2, 2, 3, 2, 1, 21, 16, 16, 17, 14, 16, 14, 15, 14, 135, 127, 120, 119, 114, 117, 107, 110, 112, 1033, 983, 958, 930, 924, 878, 902, 876, 879, 8392, 8013, 7863, 7678, 7560, 7445, 7408, 7323, 7224, 70435, 67883, 66330, 65367, 64336, 63799, 63129, 62712, 62090
Offset: 1

Author

Stuart Coe, Sep 11 2024

Keywords

Examples

			The primes and the run lengths of their initial digits begin
  primes   2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ...
  runs                 \------------/  \----/  \----/
  lengths  1  1  1  1         4          2       2     ...
		

Crossrefs

Programs

  • Python
    from sympy import primepi
    def A376129(n):
        if n<5: return 1
        def f(m): return (lambda x:primepi(10**x[0]*(x[1]+1)))(divmod(m,9))
        return int(f(n+5)-f(n+4)) # Chai Wah Wu, Oct 16 2024

Formula

a(n) = A000720(A037124(n+6)) - A000720(A037124(n+5)) for n >= 5. - Pontus von Brömssen, Oct 07 2024

A376252 Concatenated (n+1)||n modulo n.

Original entry on oeis.org

0, 0, 1, 2, 0, 4, 3, 2, 1, 0, 1, 4, 9, 2, 10, 4, 15, 10, 5, 0, 16, 12, 8, 4, 0, 22, 19, 16, 13, 10, 7, 4, 1, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 10, 8, 6, 4, 2, 0, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20
Offset: 1

Author

Stuart Coe, Sep 17 2024

Keywords

Comments

There is an interesting and striking pattern in the graph of this sequence that appears at n >= 20 and appears to continue indefinitely.
There does not appear to be a corresponding pattern for other bases.
Beyond the first two terms, zeros only appear where n is a multiple of 5.

Examples

			For n=2: 32 mod 2 is 0.
For n=123: 124123 mod 123 is 16.
		

Crossrefs

Programs

  • Mathematica
    a[n_]:=Mod[FromDigits[Join[IntegerDigits[n+1],IntegerDigits[n]]],n]; Array[a,80] (* Stefano Spezia, Sep 18 2024 *)
  • PARI
    a(n) = eval(concat(Str(n+1), Str(n))) % n; \\ Michel Marcus, Sep 17 2024
    
  • PARI
    a(n) = 10*10^logint(n, 10) % n; \\ Ruud H.G. van Tol, Oct 26 2024
    
  • Python
    def a(n): return int(str(n+1)+str(n))%n
    print([a(n) for n in range(1, 81)]) # Michael S. Branicky, Sep 17 2024
    
  • Python
    def A376252(n): return int('1'+str(n))%n # Chai Wah Wu, Oct 01 2024

Formula

a(n) = 10^A055642(n) mod n. Concatenation of 1||n modulo n. - Chai Wah Wu, Oct 01 2024