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.

User: Haris Ziko

Haris Ziko's wiki page.

Haris Ziko has authored 3 sequences.

A330822 a(n) = digsum(2^a(n-1)) with a(0) = 0.

Original entry on oeis.org

0, 1, 2, 4, 7, 11, 14, 22, 25, 29, 41, 50, 76, 106, 142, 214, 313, 380, 508, 691, 875, 1184, 1687, 2243, 3164, 4126, 5578, 7855, 10676, 13981, 18659, 25421, 34277, 46409, 63023, 85658, 116248, 157660, 213892, 290554, 393145, 532838, 723451, 981020, 1328449, 1799363
Offset: 0

Author

Haris Ziko, Jan 02 2020

Keywords

Examples

			Starting with a(0) = 0.
a(1) = digsum(2^0) = digsum(1) = 1.
a(2) = digsum(2^1) = digsum(2) = 2.
a(3) = digsum(2^2) = digsum(4) = 4.
a(4) = digsum(2^4) = digsum(16) = 7.
etc.
		

Crossrefs

Programs

  • Magma
    a:=[0,1]; [n le 2 select a[n] else &+Intseq(2^Self(n-1)):n in [1..50]]; // Marius A. Burtea, Jan 03 2020
  • Mathematica
    a[0] = 0; a[n_] := a[n] = Total @ IntegerDigits[2^a[n-1]]; Array[a, 45, 0] (* Amiram Eldar, Jan 03 2020 *)
    NestList[Total[IntegerDigits[2^#]]&,0,50] (* Harvey P. Dale, Jul 19 2025 *)
  • PARI
    a(n)={my(x=0); for(i=0, n-1, x=sumdigits(2^x)); x};
    lista(nn)={my(x=0, v=vector(nn+1)); v[1]=0; for(i=1, nn, x=sumdigits(2^x); v[i+1]=x); v};
    

A329814 The smallest base b where the sum of the digits for the number n in the base b is the smallest, with 1 < b < n and a(1) = a(2) = 1.

Original entry on oeis.org

1, 1, 2, 2, 2, 2, 6, 2, 3, 2, 10, 2, 12, 7, 14, 2, 2, 2, 18, 2, 20, 11, 22, 2, 5, 5, 3, 3, 28, 3, 30, 2, 2, 2, 34, 6, 6, 19, 38, 2, 40, 6, 42, 22, 44, 23, 46, 2, 7, 5, 50, 26, 52, 3, 54, 7, 56, 29, 58, 30, 60, 31, 62, 2, 2, 2, 66, 2, 68, 35, 70, 2, 72, 37, 74
Offset: 1

Author

Haris Ziko, Nov 21 2019

Keywords

Comments

The smallest sum of digits corresponding to a(n) is equal to 2-A075802(n), i.e., it is 1 when n is 1 or a perfect power and 2 otherwise. - Giovanni Resta, Nov 22 2019
a(n)=n-1 if and only if n is in A088905 but not in A001597. a(n)<= n/2 if n is even. - Robert Israel, Dec 05 2019

Examples

			For n = 5:
  n in base 2 = [1, 0, 1] -> digitSum(5, 2) = 2.
  n in base 3 = [1, 2] -> digitSum(5, 3) = 3.
  n in base 4 = [1, 1] -> digitSum(5, 4) = 2.
  Base 2 has the smallest sum of the digits for n = 5 ->
    therefore a(5) = 2.
For n = 7:
  n in base 2 = [1, 1, 1] -> digitSum(7, 2) = 3.
  n in base 3 = [2, 1] -> digitSum(7, 3) = 3.
  n in base 4 = [1, 3] -> digitSum(7, 4) = 4.
  n in base 5 = [1, 2] -> digitSum(7, 5) = 3.
  n in base 6 = [1, 1] -> digitSum(7, 6) = 2.
  Base 6 has the smallest sum of the digits for n = 7 ->
    therefore a(7) = 6.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local F, t,d,bmin,s,r,b;
       F:= ifactors(n)[2];
       d:= igcd(seq(t[2],t=F));
       if d > 1 then return mul(t[1]^(t[2]/d),t=F) fi;
       F:= ifactors(n-1)[2];
       d:= igcd(seq(t[2],t=F));
       if d=1 then bmin:= n-1 else bmin:= mul(t[1]^(t[2]/d),t=F) fi;
       for s in numtheory:-divisors(n) do
         r:= n/s-1;
         F:= ifactors(s)[2];
         d:= igcd(seq(t[2],t=F));
         b:= mul(t[1]^(t[2]/d),t=F);
         if b < bmin and r = b^padic:-ordp(r,b) then bmin:= b fi
       od;
       bmin;
    end proc:
    map(f, [$1..100]); # Robert Israel, Dec 05 2019
  • Mathematica
    a[n_] := Block[{b=1, r=n, t}, Do[t = Plus @@ IntegerDigits[n, i]; If[t < r, r=t; b=i], {i, 2, n-1}]; b]; Array[a, 75] (* Giovanni Resta, Nov 22 2019 *)
  • PARI
    a(n)={my(best_b=1, best_dig_sum=n); if(n>1, for(b=2, n-1, dig_sum=sumdigits(n, b); if(best_dig_sum>dig_sum, best_dig_sum=dig_sum; best_b=b))); best_b};

Extensions

More terms from Giovanni Resta, Nov 22 2019

A308828 Number of sequences that include all residues modulo n starting with x_0 = 0 and then x_i given recursively by x_{i+1} = a * x_i + c (mod n) where a and c are integers in the interval [0..n-1].

Original entry on oeis.org

1, 1, 2, 2, 4, 2, 6, 8, 18, 4, 10, 4, 12, 6, 8, 32, 16, 18, 18, 8, 12, 10, 22, 16, 100, 12, 162, 12, 28, 8, 30, 128, 20, 16, 24, 36, 36, 18, 24, 32, 40, 12, 42, 20, 72, 22, 46, 64, 294, 100, 32, 24, 52, 162, 40, 48, 36, 28, 58, 16, 60, 30, 108, 512, 48, 20, 66, 32, 44, 24
Offset: 1

Author

Haris Ziko, Jun 27 2019

Keywords

Comments

All such sequences will be cyclic with period length n.
Different values of the integers a and c modulo n will always produce different sequences.
Only sequences starting with x_0 = 0 are included here. However using any other fixed number in the interval [0..n-1] for x_0 will result in the same cycles.
It appears that the set of distinct terms of this sequence gives A049225.
From Andrew Howroyd, Aug 21 2019: (Start)
Knuth calls these sequences linear congruential sequences. Theorem A in section 3.2.1.2 of the reference states that the period has length n if and only if:
1) c is relatively prime to n;
2) a - 1 is a multiple of p for every prime p dividing n;
3) a - 1 is a multiple of 4 if n is a multiple of 4.
(End)

Examples

			For n = 1:
  a = 0, c = 0: [0];
  #cycles = 1 -> a(1) = 1.
For n = 5:
  a = 1, c = 1: [0, 1, 2, 3, 4];
  a = 1, c = 2: [0, 2, 4, 1, 3];
  a = 1, c = 3: [0, 3, 1, 4, 2];
  a = 1, c = 4: [0, 4, 3, 2, 1];
  #cycles = 4 -> a(5) = 4.
For n = 8:
  a = 1, c = 1: [0, 1, 2, 3, 4, 5, 6, 7];
  a = 1, c = 3: [0, 3, 6, 1, 4, 7, 2, 5];
  a = 1, c = 5: [0, 5, 2, 7, 4, 1, 6, 3];
  a = 1, c = 7: [0, 7, 6, 5, 4, 3, 2, 1];
  a = 5, c = 1: [0, 1, 6, 7, 4, 5, 2, 3];
  a = 5, c = 3: [0, 3, 2, 5, 4, 7, 6, 1];
  a = 5, c = 5: [0, 5, 6, 3, 4, 1, 2, 7];
  a = 5, c = 7: [0, 7, 2, 1, 4, 3, 6, 5];
  #cycles = 8 -> a(8) = 8.
		

References

  • D. E. Knuth, The Art of Computer Programming, Vol. 3, Random Numbers, Section 3.2.1.2, p. 16.

Crossrefs

Programs

  • PARI
    checkFullSet(v,n)={my(v2=vector(n), unique=1); for(i=1, n, my(j=v[i]+1); if(v2[j]==1, unique=0; break, v2[j]=1;);); unique;};
    doCycle(a,c,m)={my(v_=vector(m), x=c); v_[1]=c; for(i=1, m-1, v_[i+1]=(a*v_[i]+c)%m;); v_;};
    getCycles(m)={my(L=List()); for(a=0, m-1, for(c=0, m-1, my(v1=doCycle(a,c,m)); if(checkFullSet(v1,m), listput(L, v1)););); Mat(Col(L))};
    a(n)={my(M=getCycles(n)); matsize(M)[1]};

Formula

Conjecture: a(n) = A135616(n)/n.
Conjecture: a(n) = phi(n)*A003557(n / gcd(n,2)). - Andrew Howroyd, Aug 20 2019