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.

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.