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

A249147 a(n) = 0 if A249148(n) = 1, otherwise the index of the least prime dividing A249148(n): a(n) = A055396(A249148(n)).

Original entry on oeis.org

0, 1, 0, 2, 0, 1, 2, 1, 1, 1, 4, 0, 3, 0, 1, 1, 5, 0, 4, 1, 1, 1, 2, 1, 1, 1, 1, 9, 0, 1, 1, 2, 1, 1, 1, 11, 0, 2, 6, 1, 1, 12, 0, 1, 1, 2, 1, 1, 14, 0, 5, 2, 2, 1, 15, 0, 1, 4, 4, 1, 1, 1, 3, 2, 1, 1, 17, 0, 6, 3, 1, 1, 1, 2, 3, 1, 1, 1, 20, 0, 1, 1, 2, 1, 4, 2, 10, 0, 2, 1, 1, 22, 0, 1, 23, 0, 7
Offset: 1

Views

Author

Antti Karttunen, Oct 24 2014

Keywords

Crossrefs

Programs

  • PARI
    A049084(n) = if(isprime(n), primepi(n), 0); \\ This function from Charles R Greathouse IV
    A249147_write_bfile(up_to_n) = { my(pfcounts, n, a_n, x_n, f, k); pfcounts = vector(up_to_n); x_n = 1; for(n = 0, up_to_n, if((1 == x_n), pfcounts[1]++; x_n = pfcounts[1]; a_n = 0, f=factor(x_n); for(i=1,#f~,k = A049084(f[i,1])+1; pfcounts[k] += f[i,2]); a_n = A049084(f[1,1]); x_n = pfcounts[a_n+1]); if(n>0,write("b249147.txt", n, " ", a_n))); };
    A249147_write_bfile(10000);
    
  • Scheme
    (define (A249147 n) (A055396 (A249148 n)))

Formula

a(n) = A055396(A249148(n)).

A248034 a(n+1) gives the number of occurrences of the last digit of a(n) so far, up to and including a(n), with a(0)=0.

Original entry on oeis.org

0, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1, 10, 2, 2, 3, 2, 4, 2, 5, 2, 6, 2, 7, 2, 8, 2, 9, 2, 10, 3, 3, 4, 3, 5, 3, 6, 3, 7, 3, 8, 3, 9, 3, 10, 4, 4, 5, 4, 6, 4, 7, 4, 8, 4, 9, 4, 10, 5, 5, 6, 5, 7, 5, 8, 5, 9, 5, 10, 6, 6, 7, 6, 8, 6, 9, 6, 10, 7, 7, 8, 7, 9, 7, 10, 8, 8, 9, 8, 10, 9, 9, 10
Offset: 0

Views

Author

Eric Angelini and M. F. Hasler, Oct 11 2014

Keywords

Comments

In other words, the number to the right of a comma gives the number of occurrences of the digit immediately to the left of the comma, counting from the beginning up to that digit or comma.

Crossrefs

Cf. A249068 (analogous sequence in base 8).
Cf. A249009 (analogous sequence which uses the first, not the last digit).

Programs

  • Maple
    a:= proc(n) option remember; `if`(n=0, 0,
          coeff(b(n-1), x, irem(a(n-1), 10)))
        end:
    b:= proc(n) option remember; `if`(n=0, 1, b(n-1)+
          add(x^i, i=convert(a(n), base, 10)))
        end:
    seq(a(n), n=0..120);  # Alois P. Heinz, Oct 18 2014
  • Mathematica
    nn = 120; a[0] = j = 0; c[] := 0; Do[Map[c[#]++ &, IntegerDigits[j]]; a[n] = j = c[Mod[j, 10]], {n, nn}]; Array[a, nn, 0] (* _Michael De Vlieger, Aug 07 2023 *)
  • PARI
    c=vector(10);print1(a=0);for(n=1,99,apply(d->c[d+1]++,if(a,digits(a)));print1(","a=c[1+a%10]))
    (MIT/GNU Scheme)
    ;; An implementation of memoization-macro definec can be found for example from: http://oeis.org/wiki/Memoization
    (definec (A248034 n) (if (zero? n) n (vector-ref (A248034aux_digit_counts (- n 1)) (modulo (A248034 (- n 1)) 10))))
    (definec (A248034aux_digit_counts n) (cond ((zero? n) (vector 1 0 0 0 0 0 0 0 0 0)) (else (let loop ((digcounts-for-n (vector-copy (A248034aux_digit_counts (- n 1)))) (n (A248034 n))) (cond ((zero? n) digcounts-for-n) (else (vector-set! digcounts-for-n (modulo n 10) (+ 1 (vector-ref digcounts-for-n (modulo n 10)))) (loop digcounts-for-n (floor->exact (/ n 10)))))))))
    ;; Antti Karttunen, Oct 22 2014
    
  • Python
    from itertools import islice
    def A248034_gen(): # generator of terms
        c, clist = 0, [1]+[0]*9
        while True:
            yield c
            c = clist[c%10]
            for d in str(c):
                clist[int(d)] += 1
    A248034_list = list(islice(A248034_gen(),30)) # Chai Wah Wu, Dec 13 2022

A249336 a(1) = 1; for n>1, a(n) = number of values k in range 1 .. n-1 such that {sum of prime indices in the prime factorization of a(k)} = {sum of prime indices in the prime factorization of a(n-1)}, both counted with multiplicity.

Original entry on oeis.org

1, 1, 2, 1, 3, 1, 4, 2, 2, 3, 3, 4, 5, 1, 5, 2, 4, 6, 3, 7, 1, 6, 4, 8, 5, 6, 7, 2, 5, 8, 9, 3, 9, 4, 10, 5, 10, 6, 11, 1, 7, 7, 8, 12, 9, 10, 11, 2, 6, 13, 1, 8, 14, 3, 11, 4, 12, 12, 13, 2, 7, 14, 5, 15, 6, 16, 15, 7, 16, 17, 1, 9, 18, 8, 17, 2, 8, 18, 9, 19, 1, 10, 20, 10, 21, 3, 13, 4, 14, 11, 12, 22, 5, 19, 2, 9, 23, 1
Offset: 1

Views

Author

Antti Karttunen, Oct 25 2014

Keywords

Comments

The initial occurrences of primes appear in ascending order. After a(1) and a(2), 1's occur only after each such initial occurrence of a prime, followed by that prime's index (in A000040) + 2.

Examples

			a(1) = 1 by definition.
For n = 2, we see that a(n-1) = a(1) = 1, the sum of whose prime indices is 0, and the only integer k for which A056239(k) = 0 is 1, and 1 occurs once among the terms a(1) .. a(1), thus a(2) = 1 also.
For n = 3, we see that a(n-1) = a(2) = 1 occurs two times among the terms a(1) .. a(2), thus a(3) = 2.
For n = 4, we see that a(n-1) = a(3) = 2, and A056239(2) = 1, and so far there are no other terms than a(3) in a(1) .. a(3) which would result the same sum, thus a(4) = 1.
For n = 5, we see that a(n-1) = a(4) = 1 occurs three times in a(1) .. a(4), thus a(5) = 3.
For n = 6, we see that a(n-1) = a(5) = 3, and A056239(3) = 2 (as 3 = p_2), and so far there are no other terms than a(5) in a(1) .. a(5) which would result the same sum, thus a(6) = 1.
For n = 7, we see that a(n-1) = a(6) = 1 occurs four times in a(1) .. a(6), thus a(7) = 4.
For n = 8, we see that a(n-1) = a(7) = 4, and A056239(4) = 2 (as 4 = p_1 * p_1), and so far among the terms a(1) .. a(7) only a(5) results in the same sum, thus a(8) = 2.
		

Crossrefs

Cf. A056239, A249338 (sum of prime indices of n-th term), A249339 (positions of ones), A249340 (positions of first occurrences of each noncomposite).
Cf. also A249337 (a similar sequence with a slightly different starting condition), A249148.

Programs

  • PARI
    A049084(n) = if(isprime(n), primepi(n), 0); \\ This function from Charles R Greathouse IV
    A056239(n) = { my(f); if(1==n, 0, f=factor(n); sum(i=1, #f~, f[i,2] * A049084(f[i,1]))); }
    A249336_write_bfile(up_to_n) = { my(counts, n, a_n); counts = vector(up_to_n); a_n = 1; for(n = 1, up_to_n, write("b249336.txt", n, " ", a_n); counts[1+A056239(a_n)]++; a_n = counts[1+A056239(a_n)]); };
    A249336_write_bfile(12580);
    
  • Scheme
    ;; With memoization-macro definec from Antti Karttunen's IntSeq-library:
    (definec (A249336 n) (if (<= n 1) n (let ((s (A056239 (A249336 (- n 1))))) (let loop ((i (- n 1)) (k 0)) (cond ((zero? i) k) ((= (A056239 (A249336 i)) s) (loop (- i 1) (+ k 1))) (else (loop (- i 1) k))))))) ;; Slow, quadratic time implementation.

Formula

a(1) = 1; for n>1, a(n) = number of values k in range 1 .. n-1 such that A056239(a(k)) = A056239(a(n-1)).

A249337 a(1) = 1, a(2) = 2; for n>2, a(n) = number of values k in range 1 .. n-1 such that {sum of prime indices in the prime factorization of a(k)} = {sum of prime indices in the prime factorization of a(n-1)}, both counted with multiplicity.

Original entry on oeis.org

1, 2, 1, 2, 2, 3, 1, 3, 2, 4, 3, 4, 5, 1, 4, 6, 2, 5, 3, 7, 1, 5, 4, 8, 5, 6, 7, 2, 6, 8, 9, 3, 9, 4, 10, 5, 10, 6, 11, 1, 6, 12, 7, 8, 13, 1, 7, 9, 10, 11, 2, 7, 12, 13, 2, 8, 14, 3, 11, 4, 12, 14, 5, 15, 6, 16, 15, 7, 16, 17, 1, 8, 17, 2, 9, 18, 8, 18, 9, 19, 1, 9, 20, 10, 21, 3, 13, 4, 14, 11, 12, 22, 5, 19, 2, 10, 23, 1
Offset: 1

Views

Author

Antti Karttunen, Oct 25 2014

Keywords

Crossrefs

Cf. A056239, A249072 (sum of prime indices of n-th term), A249341 (positions of ones), A249342 (positions of the first occurrences of each noncomposite).
Cf. also A249336 (a similar sequence with a slightly different starting condition), A249148.

Programs

  • PARI
    A049084(n) = if(isprime(n), primepi(n), 0); \\ This function from Charles R Greathouse IV
    A056239(n) = { my(f); if(1==n, 0, f=factor(n); sum(i=1, #f~, f[i,2] * A049084(f[i,1]))); }
    A249337_write_bfile(up_to_n) = { my(counts, n, a_n); counts = vector(up_to_n); a_n = 1; for(n = 1, up_to_n, write("b249337.txt", n, " ", a_n); counts[1+A056239(a_n)]++; if(1 == n, a_n = 2, a_n = counts[1+A056239(a_n)])); };
    A249337_write_bfile(12580);
    
  • Scheme
    ;; With memoization-macro definec from Antti Karttunen's IntSeq-library.
    (definec (A249337 n) (if (<= n 2) n (let ((s (A056239 (A249337 (- n 1))))) (let loop ((i (- n 1)) (k 0)) (cond ((zero? i) k) ((= (A056239 (A249337 i)) s) (loop (- i 1) (+ k 1))) (else (loop (- i 1) k))))))) ;; Slow, quadratic time implementation.

Formula

a(1) = 1, a(2) = 2; for n>2, a(n) = number of values k in range 1 .. n-1 such that A056239(a(k)) = A056239(a(n-1)).

A249144 a(0) = 0, after which a(n) gives the total number of runs of the same length as the rightmost run in the binary representation of a(n-1) [i.e., A136480(a(n-1))] among the binary expansions of all previous terms, including the runs in a(n-1) itself.

Original entry on oeis.org

0, 1, 2, 4, 1, 6, 7, 1, 8, 2, 11, 3, 4, 5, 17, 19, 7, 4, 8, 5, 25, 26, 29, 31, 1, 32, 2, 35, 12, 14, 37, 41, 45, 49, 50, 52, 22, 57, 58, 61, 63, 1, 64, 2, 67, 25, 69, 73, 76, 32, 3, 33, 80, 4, 34, 87, 14, 92, 35, 36, 38, 99, 42, 105, 108, 47, 5, 114, 116, 49, 119, 23, 24, 25, 123, 54, 126, 127, 1, 128, 2
Offset: 0

Views

Author

Antti Karttunen, Oct 22 2014

Keywords

Comments

Inspired by A248034.

Examples

			a(0) = 0 (by definition), and 0 is also '0' in binary.
For n = 1, we see that in a(0) there is one run of length 1, which is total number of runs of length 1 so far in terms a(0) .. a(n-1), thus a(1) = 1.
For n = 2, we see that the rightmost run of a(1) = 1 ('1' also in binary) has occurred two times in total (once in a(0) and a(1)), thus a(2) = 2.
For n = 3, we see that the rightmost run of a(2) = 2 ('10' in binary) is one bit long, and so far there has occurred four such runs in total (namely once in a(0) and a(1), twice in a(2)), thus a(3) = 4.
For n = 4, we see that the rightmost run of a(3) = 4 ('100' in binary) is two bits long, and it is so far the first and only two-bit run in the sequence, thus a(4) = 1.
For n = 5, we see that the rightmost run of a(4) = 1 ('1' in binary) is one bit long, and so far there has occurred 6 such one-bit runs in terms a(0) .. a(4), thus a(5) = 6.
For n = 6, we see that the rightmost run of a(5) = 6 ('110' in binary) is one bit long, and so far there has occurred 7 such one bit runs in terms a(0) .. a(5), thus a(6) = 7.
		

Crossrefs

Showing 1-5 of 5 results.