Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: nn987
  • Order by date
  1. nn987

    java.util.calendar

    thread269-1703513 What is the best way to store a simple date. Should I just store it as a String or should I go through the process of using java.util.calendar or something similar? I found this code on the internet and is a good example to work with dates import java.util.Calendar; import...
  2. nn987

    Binary Permutations

    this solution is something incompleted permutation([ ],[ ]). permutation( [X | L] , P ):-permutation(L,L1),add (X, L1, [ L1 | P ]). :-permutation([0,1,1,0,1,1,1,0],L).
  3. nn987

    Binary Permutations

    what you need is a predicate of shuffle. there are many
  4. nn987

    Binary Permutations

    hi perhaps you need random sequences of the same word
  5. nn987

    guys please i need help

    was simple you can download the file from this link http://www.filesanywhere.com/fs/v.aspx?v=8a6a698f5a607175ae6d thanks lol
  6. nn987

    Help with prolog Lists

    SUM LISTS OF LISTS (if you want only pairs of numbers) sum_list([], []). sum_list([[A,B]|Rest], [Current|RestResult]) :- Current is A + B, sum_list(Rest, RestResult). ?- sum_list( [[1,2],[3,4],[5,6]], X ). X = [3, 7, 11]...
  7. nn987

    Help with prolog Lists

    Calculate the sum of a list of lists %calculates the sum of one list of lists sum_List([],[]). sum_List([[E|T]|Rest],[Current|RestResult]):- soma(T,R),Current is E + R,sum_List(Rest,RestResult). %calculates the sum of one list of numbers soma([],0):-!. soma([E|T],S):-soma(T,R),S is E+R...
  8. nn987

    conected cities

    link(detroit,toronto). link(chicago,washington). link(denver,sacramento). link(sacramento,chicago). link(toronto,chicago). connected(X,Z):-link(X,Y),link(Y,Z). %connected(X,Z):-link(Z,Y),link(Y,X). cities(X,Y,C):-findall([X,Y],connected(X,Y),C).
  9. nn987

    conected cities

    hi I need one sample of the output that you want ie,one virtual result of the program. thanks
  10. nn987

    please help me with this small problem

    for simple atomic statement max(X,Y,X):-X >= Y. max(X,Y,Y):-X < Y. And for one list of numbers. maxLis( [] ). maxList( [E],E ). maxList( [E,E2 | T],L ):-maxList( [E2 | T],L1 ),max(L1,E,L).
  11. nn987

    Binary Files in Prolog

    this program calculates the binary of any number. all you must do is write binario(7,X) for example. % |0 se x<y % div(x,y)| % |1+div(x-y,y) se x>=y % div(4,2,X). div(X,Y,0):-X<Y. div(X,Y,Z):-X>=Y, X1 is X-Y, div(X1,Y,Z1),Z is 1+Z1...
  12. nn987

    building a predicate 'is_top'

    %first put into a list lstCard(C):-findall(Y,card(_,Y),C). %the last element of the list lastb([]):-!,fail. lastb([E],E):-!. lastb([_|T],L):-lastb(T,L). %is_top(e). is_top(L):-lstCard(C),lastb(C,L).
  13. nn987

    building a predicate 'is_top'

    Hi no need to of complicate. You need put all in to a list. and write the predicate LAST nn987
  14. nn987

    building a predicate 'is_top'

    hi create a list with all the elements. reverte the list and the top is the on the head I don´t know if you can use predicates pre defined like "findall, reverse,head" Ricardo :)
  15. nn987

    generate all perfect numbers until 100. ...

    correction of last program. This program need to improve performance with a prime numbers test faster. %---------------- %Find perfect numbers hasFactor(_,0):-!,fail. hasFactor(N,L):-L<N,N mod L=:=0. hasFactor(N,L):-L<N,L2 is L+1,hasFactor(N,L2). %test of prime number %isprime([3],Z)...
  16. nn987

    generate all perfect numbers until 100. ...

    thanks yes I have one error on the first part of this formula I need to check, not only that p is prime,but that 2^p-1 is also prime(first part of the formula).
  17. nn987

    generate all perfect number until 100...

    someone asked how to calculate the perfect numbers until 100 .And know I don't find that person. But here it is . %generate all perfect number until 100... %Create perfect numbers %divisible(10,2). divisible(X,Y):- N is Y*Y,N =< X,X mod Y =:= 0. divisible(X,Y):- Y < X, Y1 is Y + 1...
  18. nn987

    generate all perfect numbers until 100. ...

    Someone asked how to calculate the perfect numbers until 100 .And know I don't find that person. But here it is %generate all perfect number until 100... %Create perfect numbers %divisible(10,2). divisible(X,Y):- N is Y*Y,N =< X,X mod Y =:= 0. divisible(X,Y):- Y < X, Y1 is Y + 1...
  19. nn987

    generate a list of prime numbers

    %Create a list of prime numbers %divisible(X,Y):- Y=<X,X mod Y =:= 0. %divisble(X,Y):- Y < X, Y1 is Y + 1, divisible(X,Y1). %divisible(10,2). divisible(X,Y):- N is Y*Y,N =< X,X mod Y =:= 0. divisible(X,Y):- Y < X, Y1 is Y + 1, divisible(X,Y1). %isprime([3],Z). isprime([X|_],X):-Y is 2, X >1...
  20. nn987

    generate a list of prime numbers

    hi all :) how can I generate a list of Prime numbers until N. i.e primes(20,L). [2,3,5,7,11,13,17,19] thanks.

Part and Inventory Search

Back
Top