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

A357190 a(n) is the least prime p such that A234575(p, A007953(p)) is the n-th power of a prime.

Original entry on oeis.org

17, 13, 131, 107, 383, 613, 43607, 1021, 334403, 26099, 40637, 138967, 212867, 360049, 502210997, 2227399, 5682166613, 7339303, 13630913, 35650627, 92273957, 142605709, 4424729404133, 671087119, 42364430471219, 2684353351, 404156666702231, 10737417109, 4872756792902003
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Oct 25 2022

Keywords

Comments

a(n) is the least prime p such that the sum of the quotient and remainder on division of p by the sum of digits of p is the n-th power of an integer.

Examples

			a(3) = 131 because 131 is prime, has sum of digits 5, 131 = 26*5 + 1 and 26 + 1 = 27 = 3^3 where 3 is prime; and 131 is the least prime that works.
		

Crossrefs

Programs

  • Maple
    g:= proc(t,M) local s,q,r,n;
      for s from 2 to 9*M do
        for r from s-1 to 1 by -1 do
          q:= t-r;
          n:= q*s+r;
          if convert(convert(n,base,10),`+`) = s and isprime(n) then return n fi;
          if n >= 10^M then return -1 fi;
       od od;
       -1
    end proc:
    G:= proc(m) local i,M,found,v,r;
      found:= false; r:= infinity;
      for M from 3 while not found do
        for i from 1 while ithprime(i)^m < 10^M do
          v:= g(ithprime(i)^m, M);
          if v > 0 then found:= true; r:= min(v,r) fi
      od od:
      r
    end proc:
    map(G, [$1..30]);

A358034 Numbers k such that A234575(k,s) = s^2 where s = A007953(k).

Original entry on oeis.org

1, 113, 313, 331, 512, 1271, 2065, 2137, 2173, 2705, 3291, 3931, 4066, 4913, 5832, 6535, 6553, 6571, 6607, 6625, 6643, 6661, 6715, 6733, 6751, 6805, 6823, 6841, 7715, 13479, 13686, 15289, 15577, 17576, 19449, 19683, 21898, 23969, 49789, 49897, 49969
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Oct 25 2022

Keywords

Comments

Numbers k such that, if the sum of digits of k is s, the quotient and remainder on division of k by s sum to s^2.

Examples

			a(3) = 313 is a term because the sum of digits of 313 is 7, 313 = 44*7+5, and 44+5 = 49 = 7^2.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local s,q,r;
      s:= convert(convert(n,base,10),`+`);
    r:= n mod s;
      q:= (n-r)/s;
    q+r = s^2
    end proc:
    select(filter, [$1..10^6]);
  • Python
    from itertools import count, islice
    def A358034_gen(startvalue=1): # generator of terms >= startvalue
        return filter(lambda n:(s:=sum(int(d) for d in str(n)))**2 == sum(divmod(n,s)),count(max(startvalue,1)))
    A358034_list = list(islice(A358034_gen(),30)) # Chai Wah Wu, Oct 26 2022

A372523 Triangle read by rows: T(n, k) is equal to n/k if k | n, else to the concatenation of A003988(n, k) = floor(n/k) and A051127(k, n) = n mod k.

Original entry on oeis.org

1, 2, 1, 3, 11, 1, 4, 2, 11, 1, 5, 21, 12, 11, 1, 6, 3, 2, 12, 11, 1, 7, 31, 21, 13, 12, 11, 1, 8, 4, 22, 2, 13, 12, 11, 1, 9, 41, 3, 21, 14, 13, 12, 11, 1, 10, 5, 31, 22, 2, 14, 13, 12, 11, 1, 11, 51, 32, 23, 21, 15, 14, 13, 12, 11, 1, 12, 6, 4, 3, 22, 2, 15, 14, 13, 12, 11, 1
Offset: 1

Views

Author

Stefano Spezia, May 04 2024

Keywords

Examples

			The triangle begins:
  1;
  2,  1;
  3, 11,  1;
  4,  2, 11,  1;
  5, 21, 12, 11,  1;
  6,  3,  2, 12, 11,  1;
  7, 31, 21, 13, 12, 11, 1;
  ...
		

Crossrefs

Cf. A000012 (right diagonal), A000027 (1st column).

Programs

  • Mathematica
    T[n_,k_]:=If[Divisible[n,k],n/k,FromDigits[Join[IntegerDigits[Floor[n/k]],IntegerDigits[Mod[n,k]]]]]; Table[T[n,k],{n,12},{k,n}]//Flatten (* or *)
    T[n_,k_]:=Floor[n/k]10^IntegerLength[Mod[n,k]]+Mod[n,k]; Table[T[n,k],{n,12},{k,n}]//Flatten (* or *)
    T[n_, k_]:=SeriesCoefficient[x^k(1+Sum[(i + 10^(1+Floor[Log10[Mod[n,k]]]))*x^i, {i, k-1}] - Sum[i*x^(k+i), {i, k-1}])/(1-x^k)^2, {x, 0, n}]; Table[T[n, k], {n, 12}, {k, n}]//Flatten

Formula

T(n, k) = floor(n/k)*10^(1+floor(log10(n mod k))) + (n mod k) if n is not divisible by k.
T(n, n) = 1.
T(n, 1) = n.
T(n, k) = 2*T(n-k, k) - T(n-2*k, k) for n >= 3*k.
T(n, k) = [x^n] x^k*(1 + (Sum_{i=1..k-1} (i + 10^(1+floor(log10(n mod k))))*x^i) - (Sum_{i=1..k-1} i*x^(k+i)))/(1 - x^k)^2.

A358052 Triangular array read by rows. For T(n,k) where 1 <= k <= n, start with x = k and repeat the map x -> floor(n/x) + (n mod x) until an x occurs that has already appeared. The number of applications of the map is T(n,k).

Original entry on oeis.org

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

Views

Author

J. M. Bergot and Robert Israel, Oct 27 2022

Keywords

Comments

T(n,k) = 1 if k^2 >= n > k and k-1 divides n-k.
If A234575(n,k) = j then either T(n,k) = T(n,j)+1 and A357554(n,k) = A357554(n,j), or T(n,k) = T(n,j), A357554(n,k) = k and A357554(n,j) = j.

Examples

			For T(13,2) we have 2 -> floor(13/2) + (13 mod 2) = 7 -> floor(13/7) + (13 mod 7) = 7.  That is two applications of the map so T(13,2) = 2.
Triangle starts:
  1;
  2, 2;
  2, 1, 2;
  2, 1, 2, 2;
  2, 2, 1, 3, 2;
  2, 2, 2, 3, 3, 2;
  2, 2, 1, 1, 2, 3, 2;
  2, 2, 3, 2, 3, 4, 3, 2;
  2, 2, 1, 2, 1, 3, 2, 3, 2;
  2, 2, 2, 1, 2, 3, 2, 3, 3, 2;
		

Crossrefs

Programs

  • Maple
    f:= proc(n, k) local x, S,count;
      S:= {k};
      x:= k;
      for count from 1 do
         x:= iquo(n, x) + irem(n, x);
         if member(x, S) then return count fi;
         S:= S union {x};
      od
    end proc:
    for n from 1 to 20 do seq(f(n, k), k=1..n) od;
  • Mathematica
    f[n_, k_] := Module[{x, S, count}, S = {k}; x = k; For[count = 1, True, count++, x = Quotient[n, x] + Mod[n, x]; If[MemberQ[S, x], Return[count]]; S = S~Union~{x}]];
    Table[f[n, k], {n, 1, 20}, {k, 1, n}] // Flatten (* Jean-François Alcover, Jan 29 2023, after Maple code *)

A234541 Least k such that floor(n/k) + (n mod k) is a prime, or 0 if no such k exists.

Original entry on oeis.org

0, 1, 1, 2, 1, 2, 1, 4, 2, 2, 1, 4, 1, 2, 3, 8, 1, 6, 1, 4, 2, 2, 1, 8, 2, 2, 5, 4, 1, 6, 1, 6, 2, 2, 3, 12, 1, 2, 3, 8, 1, 6, 1, 4, 2, 2, 1, 16, 3, 10, 3, 4, 1, 18, 3, 6, 2, 2, 1, 8, 1, 2, 6, 18, 3, 6, 1, 4, 3, 4, 1, 14, 1, 2, 9, 4, 5, 6, 1, 16, 2, 2, 1, 12, 2, 2
Offset: 1

Views

Author

Alex Ratushnyak, Dec 27 2013

Keywords

Comments

a(n) = 1 only if n is a prime.
a(2m) <= m, because with k=m, floor(2m/m)+(2m mod m) = 2.
a(2m+1) <= 2m: floor((2m+1)/2m) + ((2m+1) mod 2m) = 1 + 1 = 2.

Crossrefs

Programs

  • Python
    primes = [2, 3]
    primFlg = [0]*100000
    primFlg[2] = primFlg[3] = 1
    def appPrime(k):
      for p in primes:
        if k%p==0:  return
        if p*p > k:  break
      primes.append(k)
      primFlg[k] = 1
    for n in range(5, 100000, 6):
      appPrime(n)
      appPrime(n+2)
    for n in range(1, 100000):
      a = 0
      for k in range(1, n):
        c = n//k + n%k
        if primFlg[c]:  # if c in primes:
          a = k
          break
      print(str(a), end=', ')
    
  • Scheme
    ;; MIT/GNU Scheme, with Aubrey Jaffer's SLIB Scheme library and function A234575bi as defined in A234575
    (require 'factor) ;; For predicate prime? from SLIB-library.
    (define (A234541 n) (let loop ((k 1)) (cond ((prime? (A234575bi n k)) k) ((> k n) 0) (else (loop (+ 1 k))))))
    ;; Antti Karttunen, Dec 29 2013

A358055 a(n) is the least m such that A358052(m,k) = n for some k.

Original entry on oeis.org

1, 2, 5, 8, 14, 20, 32, 38, 59, 59, 63, 116, 122, 158, 158, 218, 278, 278, 402, 548, 642, 642, 642, 642, 642, 1062, 1062, 1668, 2474, 2690, 2690, 2690, 2690, 2690, 3170, 3170, 3170, 3170, 3170, 3170, 3170, 9260, 9260, 9260, 9788, 9788, 11772, 11942, 11942, 11942, 11942, 11942
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Oct 27 2022

Keywords

Comments

a(n) is the least m such that iteration of the map x -> floor(m/x) + (m mod x), starting at some k in [1,m], produces n distinct values before repeating.

Examples

			a(4) = 8 because A358052(8,6) = 4 and this is the first appearance of 4 in A358052.
Thus the map x -> floor(8/x) + (8 mod x) starting at 6 produces 4 distinct values before repeating: 6 -> 3 -> 4 -> 2 -> 4.
		

Crossrefs

Programs

  • Maple
    f:= proc(n, k) local x, S, count;
      S:= {k};
      x:= k;
      for count from 1 do
         x:= iquo(n, x) + irem(n, x);
         if member(x, S) then return count fi;
         S:= S union {x};
      od
    end proc:
    V:= Vector(50): count:= 0:
    for n from 1 while count < 50 do
      for k from 1 to n do
        v:= f(n,k);
        if v <= 50 and V[v] = 0 then
           V[v]:= n; count:= count+1;
        fi
    od od:
    convert(V,list);
  • Mathematica
    f[n_, k_] := Module[{x, S, count}, S = {k}; x = k; For[count = 1, True, count++, x = Quotient[n, x] + Mod[n, x]; If[MemberQ[S, x], Return@count]; S = S~Union~{x}]];
    V = Table[0, {vmax = 40}]; count = 0;
    For[n = 1, count < vmax, n++, For[k = 1, k <= n, k++, v = f[n, k]; If[v <= vmax && V[[v]] == 0, Print[n]; V[[v]] = n; count++]]];
    V (* Jean-François Alcover, Mar 12 2024, after Maple code *)
Showing 1-6 of 6 results.