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

A276150 Sum of digits when n is written in primorial base (A049345); minimal number of primorials (A002110) that add to n.

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Aug 22 2016

Keywords

Comments

The sum of digits of n in primorial base is odd if n is 1 or 2 (mod 4) and even if n is 0 or 3 (mod 4). Proof: primorials are 1 or 2 (mod 4) and a(n) can be constructed via the greedy algorithm. So if n = 4k + r where 0 <= r < 4, 4k needs an even number of primorials and r needs hammingweight(r) = A000120(r) primorials. Q.E.D. - David A. Corneth, Feb 27 2019

Examples

			For n=24, which is "400" in primorial base (as 24 = 4*(3*2*1) + 0*(2*1) + 0*1, see A049345), the sum of digits is 4, thus a(24) = 4.
		

Crossrefs

Cf. A333426 [k such that a(k)|k], A339215 [numbers not of the form x+a(x) for any x], A358977 [k such that gcd(k, a(k)) = 1].
Cf. A014601, A042963 (positions of even and odd terms), A343048 (positions of records).
Differs from analogous A034968 for the first time at n=24.

Programs

  • Mathematica
    nn = 120; b = MixedRadix[Reverse@ Prime@ NestWhileList[# + 1 &, 1, Times @@ Prime@ Range[# + 1] <= nn &]]; Table[Total@ IntegerDigits[n, b], {n, 0, nn}] (* Version 10.2, or *)
    nn = 120; f[n_] := Block[{a = {{0, n}}}, Do[AppendTo[a, {First@ #, Last@ #} &@ QuotientRemainder[a[[-1, -1]], Times @@ Prime@ Range[# - i]]], {i, 0, #}] &@ NestWhile[# + 1 &, 0, Times @@ Prime@ Range[# + 1] <= n &]; Rest[a][[All, 1]]]; Table[Total@ f@ n, {n, 0, 120}] (* Michael De Vlieger, Aug 26 2016 *)
  • PARI
    A276150(n) = { my(s=0, p=2, d); while(n, d = (n%p); s += d; n = (n-d)/p; p = nextprime(1+p)); (s); }; \\ Antti Karttunen, Feb 27 2019
  • Python
    from sympy import prime, primefactors
    def Omega(n): return 0 if n==1 else Omega(n//primefactors(n)[0]) + 1
    def a276086(n):
        i=0
        m=pr=1
        while n>0:
            i+=1
            N=prime(i)*pr
            if n%N!=0:
                m*=(prime(i)**((n%N)/pr))
                n-=n%N
            pr=N
        return m
    def a(n): return Omega(a276086(n))
    print([a(n) for n in range(201)]) # Indranil Ghosh, Jun 23 2017
    

Formula

a(n) = 1 + a(A276151(n)) = 1 + a(n-A002110(A276084(n))), a(0) = 0.
or for n >= 1: a(n) = 1 + a(n-A260188(n)).
Other identities and observations. For all n >= 0:
a(n) = A001222(A276086(n)) = A001222(A278226(n)).
a(n) >= A371091(n) >= A267263(n).
From Antti Karttunen, Feb 27 2019: (Start)
a(n) = A000120(A277022(n)).
a(A283477(n)) = A324342(n).
(End)
a(n) = A373606(n) + A373607(n). - Antti Karttunen, Jun 19 2024

A338829 a(n) is the greatest number not yet in the sequence with the same number of digits and the same sum of digits as n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 20, 30, 40, 50, 60, 70, 80, 90, 91, 11, 21, 31, 41, 51, 61, 71, 81, 82, 92, 12, 22, 32, 42, 52, 62, 72, 73, 83, 93, 13, 23, 33, 43, 53, 63, 64, 74, 84, 94, 14, 24, 34, 44, 54, 55, 65, 75, 85, 95, 15, 25, 35, 45, 46, 56, 66, 76
Offset: 0

Views

Author

Rémy Sigrist, Nov 11 2020

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.
We have a fixed point with m digits and sum of digits k whenever A289410(m, k) is odd.

Examples

			For n = 23:
- the numbers with 2 digits and sum of digits 5 are: 14, 23, 32, 41 and 50,
- so  a(14) = 50,
      a(23) = 41,
      a(32) = 32,
      a(41) = 23,
      a(50) = 14.
		

Crossrefs

Cf. A055642, A289410, A331274 (binary analog), A333659, A338834 (factorial base analog), A338835 (primorial base analog).

Programs

  • Mathematica
    Block[{a = {}, f, k}, f[x_] := Total@ IntegerDigits@ x; Do[k = f[i]; AppendTo[a, SelectFirst[Range[10^# - 1, 10^(# - 1), -1] &@ Floor[1 + Log10[i]], And[f[#] == k, FreeQ[a, #]] &]], {i, 67}]; a] (* Michael De Vlieger, Nov 13 2020 *)
  • PARI
    See Links section.

Formula

A055642(a(n)) = A055642(n).
A007953(a(n)) = A007953(n).

A338834 a(n) is the greatest number not yet in the sequence with the same number of digits and the same sum of digits as n in factorial base.

Original entry on oeis.org

0, 1, 2, 4, 3, 5, 6, 12, 8, 18, 14, 20, 7, 13, 10, 19, 16, 22, 9, 15, 11, 21, 17, 23, 24, 48, 30, 72, 54, 96, 26, 50, 49, 78, 74, 102, 36, 73, 60, 98, 97, 108, 56, 84, 80, 104, 103, 114, 25, 32, 31, 55, 52, 79, 28, 51, 42, 76, 75, 100, 38, 66, 62, 99, 90, 110
Offset: 0

Views

Author

Rémy Sigrist, Nov 11 2020

Keywords

Comments

This sequence is a self-inverse permutation of the nonnegative integers.

Examples

			For n = 26:
- the numbers with 4 digits and sum of digits 2 in factorial base are: 25 ("1001"), 26 ("1010"), 30 ("1100") and 48 ("2000"),
- so a(25) = 40,
     a(26) = 30,
     a(30) = 26,
     a(40) = 25.
		

Crossrefs

Cf. A034968, A084558, A337598, A338829 (decimal analog), A338835 (primorial base analog).

Programs

  • PARI
    See Links section.

Formula

A084558(a(n)) = A084558(n).
A034968(a(n)) = A034968(n).
Showing 1-3 of 3 results.