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

A355034 a(n) is the least base b >= 2 where the sum of digits of n is a prime number.

Original entry on oeis.org

3, 2, 3, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 3, 8, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 5, 2, 3, 3, 2, 4, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 4, 2, 2, 2, 2, 3, 2, 3, 3, 2, 2, 3, 4, 2, 6, 2, 2, 3, 18, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 6, 2, 2, 2, 2, 3, 2, 3, 4, 2, 2
Offset: 2

Views

Author

Rémy Sigrist, Jun 16 2022

Keywords

Comments

The sequence is well defined:
- a(2) = 3,
- for n >= 3, the expansion of n in base n-1 is "11", with sum of digits 2.

Examples

			For n = 16:
- we have the following expansions and sum of digits:
     b  16_b     Sum of digits in base b
     -  -------  -----------------------
     2  "10000"                        1
     3    "121"                        4
     4    "100"                        1
     5     "31"                        4
     6     "24"                        6
     7     "22"                        4
     8     "20"                        2
- so a(16) = 8.
		

Crossrefs

Cf. A052294, A216789, A355035 (corresponding prime numbers).

Programs

  • PARI
    a(n) = for (b=2, oo, if (isprime(sumdigits(n,b)), return (b)))
    
  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def a(n):
        b = 2
        while not isprime(sum(digits(n, b)[1:])): b += 1
        return b
    print([a(n) for n in range(2, 89)]) # Michael S. Branicky, Jun 16 2022

Formula

a(n) = 2 iff n belongs to A052294.
a(n) <= n-1 for any n >= 3.

A352671 a(n) is the number of nonnegative numbers k < n such that for any base b >= 2, the sum of digits of n and k in base b are different.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 28 2022

Keywords

Comments

See A352740 for the corresponding k's.

Examples

			The first terms, alongside the corresponding k's, are:
  n   a(n)  k's
  --  ----  --------------
   1     1  0
   2     1  0
   3     2  0, 2
   4     2  0, 3
   5     2  0, 4
   6     1  0
   7     3  0, 4, 6
   8     3  0, 6, 7
   9     3  0, 7, 8
  10     2  0, 8
  11     5  0, 6, 8, 9, 10
  12     2  0, 11
		

Crossrefs

Programs

  • PARI
    a(n) = { my (v=0); for (k=0, n-1, my (ok=1); for (b=2, max(2, n+1), if (sumdigits(n,b)==sumdigits(k,b), ok=0; break)); v+=ok); v }

A352740 Irregular table T(n, k) read by rows; the n-th row contains, in ascending order, the numbers k < n such that for any base b >= 2, the sum of digits of n and k in base b are different.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Mar 31 2022

Keywords

Comments

A352671 gives row lengths.

Examples

			irregular table begins:
     1:    [0]
     2:    [0]
     3:    [0, 2]
     4:    [0, 3]
     5:    [0, 4]
     6:    [0]
     7:    [0, 4, 6]
     8:    [0, 6, 7]
     9:    [0, 7, 8]
    10:    [0, 8]
		

Crossrefs

Cf. A216789, A352671 (row lengths).

Programs

  • PARI
    row(n) = { my (v=[]); for (k=0, n-1, my (ok=1); for (b=2, max(2, n+1), if (sumdigits(n, b)==sumdigits(k, b), ok=0; break)); if (ok, v=concat(v,k))); v }

Formula

T(n, 1) = 0.

A355035 Consider the least base b >= 2 where the sum of digits of n is a prime number; a(n) corresponds to this prime number.

Original entry on oeis.org

2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 3, 3, 2, 2, 2, 3, 2, 3, 3, 5, 2, 3, 3, 3, 3, 3, 2, 5, 2, 2, 2, 3, 2, 3, 3, 3, 2, 3, 3, 5, 3, 3, 7, 5, 2, 3, 3, 5, 3, 7, 2, 5, 3, 3, 7, 5, 5, 5, 5, 3, 13, 2, 2, 3, 2, 3, 3, 7, 2, 3, 3, 5, 3, 7, 3, 5, 2, 3, 3, 3, 3, 3, 5, 5, 3
Offset: 2

Views

Author

Rémy Sigrist, Jun 16 2022

Keywords

Examples

			For n = 16:
- we have the following expansions and sum of digits:
     b  16_b     Sum of digits in base b
     -  -------  -----------------------
     2  "10000"                        1
     3    "121"                        4
     4    "100"                        1
     5     "31"                        4
     6     "24"                        6
     7     "22"                        4
     8     "20"                        2
- so a(16) = 2.
		

Crossrefs

Cf. A216789, A355034 (corresponding b's).

Programs

  • PARI
    a(n) = my (s); for (b=2, oo, if (isprime(s=sumdigits(n,b)), return (s)))
    
  • Python
    from sympy import isprime
    from sympy.ntheory.digits import digits
    def s(n, b): return sum(digits(n, b)[1:])
    def a(n):
        b = 2
        while not isprime(s(n, b)): b += 1
        return s(n, b)
    print([a(n) for n in range(2, 89)]) # Michael S. Branicky, Jun 16 2022

Formula

a(n) = A216789(n, A355034(n)).
Showing 1-4 of 4 results.