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.

A372559 a(n) is the index of the first occurrence of n in A371091.

Original entry on oeis.org

0, 1, 3, 9, 21, 51, 111, 321, 741, 2001, 4311, 8931, 22791, 52821, 112881, 293061, 803571, 1824591, 4887651, 14587341, 33986721, 92184861, 208581141, 431674011, 877859751, 2216416971, 4893531411, 11363224641, 24302611101, 63120770481, 140757089241, 341317579371, 742438559631, 1945801500411, 4352527381971, 11773265516781
Offset: 0

Views

Author

Antti Karttunen, May 11 2024

Keywords

Comments

The pattern in the primorial base expansion (A049345) of the terms is constructed recursively, so that the digit-positions of the primorial base expansion are successively filled with the positive terms of this sequence (1, 3, 9, 21, ...), up to that term that still fits to the position, i.e., is less than prime(i), for the positions i >= 1 indexed from the least significant end of the expansion. The nonleading digits are "frozen", and only the most significant digit keeps on increasing from a(1) to the maximal allowed a(x) for its position, after which the next term's expansion is obtained by prepending 1 to the front. See the examples.

Examples

			   n,      a(n)     in primorial base
   0,         0 =             0
   1,         1 =             1
   2,         3 =            11
   3,         9 =           111
   4,        21 =           311 (3 is less than prime(3)=5, so can be used now)
   5,        51 =          1311 (9 cannot yet be used, so append 1 to the front)
   6,       111 =          3311 (and then replace by next higher term that fits)
   7,       321 =         13311
   8,       741 =         33311
   9,      2001 =         93311 (9 is less than prime(5)=11, so can be used now)
  10,      4311 =        193311
  11,      8931 =        393311
  12,     22791 =        993311
  13,     52821 =       1993311
  14,    112881 =       3993311
  15,    293061 =       9993311
  16,    803571 =      19993311
  17,   1824591 =      39993311
  18,   4887651 =      99993311
  19,  14587341 =     199993311
  20,  33986721 =     399993311
  21,  92184861 =     999993311
  22, 208581141 =  {21}99993311 (21 is less than prime(9)=23, so can be used now)
  23, 431674011 = 1{21}99993311
etc.
		

Crossrefs

Positions of records in A371091.

Programs

  • PARI
    A002110(n) = prod(i=1,n,prime(i));
    A235224(n) = { my(s=0, p=2); while(n, s++; n = n\p; p = nextprime(1+p)); (s); };
    A276153(n) = { my(p=2,d=0); while(n, d = n%p; n = n\p; p = nextprime(1+p)); (d); };
    memoA372559 = Map();
    A372559(n) = if(n<=2, n+(n>1), my(v); if(mapisdefined(memoA372559,n,&v), v, my(prev=A372559(n-1), hi=A235224(prev), hd=A276153(prev),k=0,u); while(A372559(k)A372559(1+k); v = if(u>=prime(hi), prev+A002110(hi), prev+((u-hd)*A002110(hi-1))); mapput(memoA372559,n,v); (v)));

Formula

For n >= 0, A371091(a(n)) = n, and for all k < a(n), A371091(k) < n.

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

A371090 Additive with a(p^1) = 1, a(p^e) = a(A276086(e)) for e > 1, where A276086 is the primorial base exp-function.

Original entry on oeis.org

0, 1, 1, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1, 1, 2, 1, 2, 2, 2, 1, 3, 1, 2, 2, 2, 1, 3, 1, 2, 2, 2, 2, 2, 1, 2, 2, 3, 1, 3, 1, 2, 2, 2, 1, 2, 1, 2, 2, 2, 1, 3, 2, 3, 2, 2, 1, 3, 1, 2, 2, 1, 2, 3, 1, 2, 2, 3, 1, 3, 1, 2, 2, 2, 2, 3, 1, 2, 1, 2, 1, 3, 2, 2, 2, 3, 1, 3, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 1, 3, 1, 3, 3, 2, 1, 3, 1, 3, 2, 2, 1, 3, 2, 2, 2, 2, 2, 4, 1, 2, 2, 2, 2, 3, 1, 2
Offset: 1

Views

Author

Antti Karttunen, Mar 31 2024

Keywords

Comments

Used to construct A371091.

Crossrefs

Differs from A064547 for the first time at n=63, where a(64) = 1, while A064547(64) = 2.
Differs from A058061 for the first time at n=128, where a(128) = 2, while A058061(128) = 3.

Programs

  • PARI
    A276086(n) = { my(m=1, p=2); while(n, m *= (p^(n%p)); n = n\p; p = nextprime(1+p)); (m); };
    A371090(n) = vecsum(apply(e->if(1==e,1,A371090(A276086(e))),factor(n)[, 2]));

Formula

Additive with a(p^1) = 1, a(p^e) = A371091(e) for e > 1.
For all n >= 1, A001221(n) <= a(n) <= A001222(n).
Showing 1-3 of 3 results.