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.

A160668 Distance between prime(n) and the next higher power of 10.

Original entry on oeis.org

8, 7, 5, 3, 89, 87, 83, 81, 77, 71, 69, 63, 59, 57, 53, 47, 41, 39, 33, 29, 27, 21, 17, 11, 3, 899, 897, 893, 891, 887, 873, 869, 863, 861, 851, 849, 843, 837, 833, 827, 821, 819, 809, 807, 803, 801, 789, 777, 773, 771, 767, 761, 759, 749, 743, 737, 731, 729, 723
Offset: 1

Views

Author

Enoch Haga, May 23 2009

Keywords

Examples

			a(1)=8 because 10^1=10, and 10-2, 1st prime 2, = 8;
a(5)=89 because 10^2=100 and 100-11, 5th prime 11, = 89.
		

Crossrefs

Programs

  • Magma
    [10^(Ceiling(Log(NthPrime(n))/Log(10))) - NthPrime(n): n in [1..30]]; // G. C. Greubel, May 02 2018
  • Maple
    a:= n-> (p-> 10^length(p)-p)(ithprime(n)):
    seq(a(n), n=1..100);  # Alois P. Heinz, Dec 08 2017
  • Mathematica
    Table[10^Ceiling[Log[Prime[n]]/Log[10]] - Prime[n], {n, 1, 100}] (* G. C. Greubel, May 02 2018 *)
  • PARI
    a(n) = 10^ceil(log(prime(n))/log(10)) - prime(n); \\ Michel Marcus, Dec 08 2017
    
  • UBASIC
    20 N=3:print N:C=2
    30 A=3:S=sqrt(N)
    40 B=N/A 50 if A*B=int(N) then 70
    60 A=A+2:if AEnoch Haga, May 22 2009
    

Formula

From Alois P. Heinz, Dec 08 2017: (Start)
a(n) = 10^A055642(A000040(n)) - A000040(n).
a(n) = A228628(n) + 1 = A061601(A000040(n)) + 1. (End)