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.

A267263 Number of nonzero digits in representation of n in primorial base.

Original entry on oeis.org

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

Views

Author

Cade Brown, Jan 12 2016

Keywords

Examples

			a(3) = 2 because 3 written in primorial base is 11 with 2 nonzero digits.
		

Crossrefs

Cf. A060735 (positions of ones).
A060130 is an analogous sequence for the factorial base, from which this differs for the first time at n=30, where a(30) = 1, while A060130(30) = 2.

Programs

  • Maple
    a:= proc(n) local m, p, r; m, p, r:= n, 2, 0;
           while m>0 do r:= r+`if`(irem(m, p, 'm')>0, 1, 0);
                        p:= nextprime(p)
           od; r
        end:
    seq(a(n), n=0..100);  # Alois P. Heinz, Jan 15 2016
  • Mathematica
    Table[Length[IntegerDigits[n, MixedRadix@ Prime@ Reverse@ Range@ PrimePi@ n] /. 0 -> Nothing], {n, 0, 120}] (* Michael De Vlieger, Jan 12 2016, Version 10.2 *)
    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[Count[f@ n, d_ /; d > 0], {n, 0, 73}] (* Michael De Vlieger, Aug 29 2016 *)
  • PARI
    cnz(n) = my(d = digits(n)); sum(k=1, #d, d[k]!=0);
    A049345(n, p=2) = if(nA049345(n\p, nextprime(p+1))*10 + n%p)
    a(n) = cnz(A049345(n)); \\ Michel Marcus, Jan 12 2016
    
  • PARI
    a(n)=my(s); forprime(p=2,, if(n%p, s++, if(n==0, return(s))); n\=p) \\ Charles R Greathouse IV, Nov 17 2016

Formula

a(n) = A001221(A276086(n)). - Antti Karttunen, Aug 21 2016