Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A081229
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A081229 a(n) is the sum of the common digits of n and the n-th prime in base 10, or -1 if there are no common digits. +0
3
-1, -1, -1, -1, -1, -1, 7, -1, -1, -1, 1, -1, 1, 4, -1, -1, -1, 1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, 9, 3, 1, 3, 3, 3, -1, -1, 7, 3, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, 5, 5, 6, -1, -1, -1, -1, -1, 2, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 7, 7, -1, -1, 7, -1, 0, 1, 2, 3, 4, -1, -1, -1, -1, -1, -1, -1, 9, -1, 13, 9, -1 (list; graph; listen)
OFFSET

1,7

COMMENT

Repeated digits are to be ignored; e.g. 2001 and 4050 have only one digit in common, 0.

EXAMPLE

a(73)=10 since the 73rd prime is 367 (3+7=10).

MAPLE

digcomp := proc(A, B) local a, b, crit, f; description "returns the digits that 'A' and 'B' have in common; if a third argument is given and it is 'sum' then the sum of the common digits is returned, else if it is 'num' then the number of common digits is returned."; if nargs>2 then crit := args[3] else crit := NULL fi; a := convert(`if`(A=0, [0], (convert(A, base, 10))), set); b := convert(`if`(B=0, [0], (convert(B, base, 10))), set); f := a intersect b; if crit=sum then return `if`(nops(f)>0, `+`(op(f)), -1) elif crit=num then return nops(f) else return f; fi; end proc; F := ([seq(digcomp(i, ithprime(i), sum), i=1..75)]);

PROGRAM

(PARI) digitset(n) = local(v, d); v=[]; while(n>0, d=divrem(n, 10); n=d[1]; v=concat(d[2], v)); Set(v)

{for(n=1, 94, s=setintersect(digitset(n), digitset(prime(n))); v=eval(s); print1(if(v==[], -1, sum(j=1, #v, v[j])), ", "))} [Klaus Brockhaus, Dec 19 2006]

CROSSREFS

Cf. A081227, A081228.

Adjacent sequences: A081226 A081227 A081228 this_sequence A081230 A081231 A081232

Sequence in context: A070672 A055061 A074465 this_sequence A109010 A117825 A010143

KEYWORD

base,sign

AUTHOR

Francois Jooste (pin(AT)myway.com), Mar 11 2003

EXTENSIONS

Entries checked by Klaus Brockhaus, Dec 19 2006

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified November 9 12:23 EST 2009. Contains 166233 sequences.


AT&T Labs Research